Skip to content

NdjsonLineDecoder

Defined in: packages/format-ndjson/src/ndjson-line-decoder.ts:33

Decodes one JSON value per \n-terminated line, skipping blank lines.

The single implementation of the NDJSON read grammar: parseNdjson and NdjsonParseStream are both driven by this rather than repeating it.

Written against string rather than Uint8Array because the grammar is defined over characters; byte-to-text conversion is the buffer’s job (TextDecodeBuffer).

  • Decoder<JsonValue, string>

new NdjsonLineDecoder(maxLineLength): NdjsonLineDecoder

Defined in: packages/format-ndjson/src/ndjson-line-decoder.ts:34

number

NdjsonLineDecoder

decode(view, context): DecodeResult<JsonValue>

Defined in: packages/format-ndjson/src/ndjson-line-decoder.ts:36

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<JsonValue>

Decoder.decode