CsvRowDecoder
Defined in: packages/format-csv/src/csv-row-decoder.ts:67
Decodes one RFC 4180 record per unquoted line terminator.
The single implementation of the CSV read grammar: parseCsv and
CsvParseStream are both driven by this rather than repeating it.
A record is self-delimiting, but only once quote state is tracked — a line terminator inside a quoted field does not end the record, which is why this cannot be a line decoder with a split applied afterwards.
Lenient on line endings: \r\n and bare \n both terminate a record,
whatever CsvOptions.newline says, since that option only controls output.
Stateful across partial records, so an instance must back exactly one driver.
Implements
Section titled “Implements”Decoder<string[],string>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CsvRowDecoder(
options?):CsvRowDecoder
Defined in: packages/format-csv/src/csv-row-decoder.ts:76
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”CsvRowDecoder
Methods
Section titled “Methods”decode()
Section titled “decode()”decode(
view,context):DecodeResult<string[]>
Defined in: packages/format-csv/src/csv-row-decoder.ts:80
Attempt to decode one value from the front of view.
view is a window into the driver’s buffer and is invalidated as soon as
this call returns. Copy anything retained in the returned value.
Parameters
Section titled “Parameters”string
context
Section titled “context”DecodeContext
Returns
Section titled “Returns”DecodeResult<string[]>
Implementation of
Section titled “Implementation of”Decoder.decode
reset()
Section titled “reset()”reset():
void
Defined in: packages/format-csv/src/csv-row-decoder.ts:126
Discard accumulated decode state ahead of a protocol mode switch.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Decoder.reset