buffer-split-transform
Creates a transform stream that splits chunks without intermediate string conversion.
usage
import split from 'buffer-split-transform'
const sink = source.pipe(split())
sink.on(`data`, console.log)
api
split([delimiter], [options])
delimiter
if set overrides the default delimiter of Buffer.from('\n')
.
options
defualts to:
{ flushRemainingChunk: true }
If flushRemainingChunk
is set to false
, the remainder of a split chunk will be omitted when the source stream ends. This can be useful if you are only interested in data before the specified delimiter.
In cases where extra verbosity is desired, split can be called like so:
split({
delimiter: Buffer.from(`\n\n`),
flushRemainingChunk: false
})