basalt / exports/src / NdjsonFormatter
Class: NdjsonFormatter
Defined in: exports/src/formatters.ts:100
Newline-delimited JSON — one object per line, ideal for streaming loads.
Implements
Constructors
Constructor
> new NdjsonFormatter(): NdjsonFormatter
Returns
NdjsonFormatter
Properties
contentType
> readonly contentType: "application/x-ndjson" = 'application/x-ndjson'
Defined in: exports/src/formatters.ts:102
Implementation of
extension
> readonly extension: "ndjson" = 'ndjson'
Defined in: exports/src/formatters.ts:103
Implementation of
format
> readonly format: "ndjson" = 'ndjson'
Defined in: exports/src/formatters.ts:101
Implementation of
Methods
render()
> render(headers, rows): Buffer
Defined in: exports/src/formatters.ts:104
Parameters
headers
string[]
rows
unknown[][]
Returns
Buffer
Implementation of
renderStream()
> renderStream(headers, rows): AsyncIterable<string>
Defined in: exports/src/formatters.ts:108
Optional incremental rendering, used by Exports.stream(). Pulls rows one at a time and yields pieces of the file as it goes, so memory stays bounded by one chunk instead of the whole dataset. The concatenated output must be byte-identical to render(). Formats whose container needs the whole data up front (XLSX's ZIP, PDF) leave this out and are buffer-only.
Parameters
headers
string[]
rows
AsyncIterable<unknown[]>
Returns
AsyncIterable<string>