Skip to content

NdjsonParseStreamOptions

NdjsonParseStreamOptions = object

Defined in: packages/format-ndjson/src/parse-stream.ts:7

optional maxBufferSize?: number

Defined in: packages/format-ndjson/src/parse-stream.ts:16

Hard ceiling on undecoded retained text, in UTF-16 code units.

Distinct from maxLineLength: that is a grammar limit the decoder reports as a recoverable error, this is the abuse backstop on how much a producer may hand over before any of it is decodable. A single write larger than this throws BufferOverflowError. Defaults to 1 MiB.


optional onError?: (error) => void

Defined in: packages/format-ndjson/src/parse-stream.ts:24

Called for a malformed or over-long line instead of erroring the stream.

Web Streams have no non-fatal error channel, so recovery has to be a policy the caller supplies. Omit it and the first bad line ends the stream.

unknown

void