UNPKG

494 BPlain TextView Raw
1import { TransformTyped } from '../stream.model'
2
3const _binarySplit = require('binary-split')
4
5/**
6 * Input: stream (objectMode=false) of arbitrary string|Buffer chunks, like when read from fs
7 * Output: stream (objectMode=false) or string|Buffer chunks split by `separator` (@default to `\n`)
8 *
9 * Useful to, for example, reading NDJSON files from fs
10 */
11export function transformSplit(separator = '\n'): TransformTyped<string | Buffer, string | Buffer> {
12 return _binarySplit(separator)
13}