UNPKG

@naturalcycles/nodejs-lib

Version:
19 lines (18 loc) 908 B
import type { TransformTyped } from '../stream.model.js'; /** * Transforms input Buffer/string stream into Buffer chunks (objectMode: true) split by newLine. * * Useful for reading NDJSON files from fs. * * Same as binarySplit, but optimized (hard-coded) to split on NEWLINE (aka `\n`). * (+5-10% _pipeline speedup measured, compared to generic `binarySplit` on variable length delimiter) */ export declare function transformSplitOnNewline(): TransformTyped<Buffer, Buffer>; /** * Input: stream (objectMode=false) of arbitrary string|Buffer chunks, like when read from fs * Output: stream (objectMode=true) or string|Buffer chunks split by `separator` (@default to `\n`) * * Please use slightly more optimized `transformSplitOnNewline` for NDJSON file parsing. * (+5-10% _pipeline speedup measured!) */ export declare function transformSplit(separator?: string): TransformTyped<Buffer, Buffer>;