Skip to content

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.

  • Decoder<string[], string>

new CsvRowDecoder(options?): CsvRowDecoder

Defined in: packages/format-csv/src/csv-row-decoder.ts:76

CsvOptions

CsvRowDecoder

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.

string

DecodeContext

DecodeResult<string[]>

Decoder.decode


reset(): void

Defined in: packages/format-csv/src/csv-row-decoder.ts:126

Discard accumulated decode state ahead of a protocol mode switch.

void

Decoder.reset