Split a stream into lines that include their line terminator if they had one.
This module exports one function:
Returns a duplex stream that splits the input by lines.
opt is an optional options object that supports these keys:
sep: RegExp for what you consider a line terminator. Default:
nEolGroups: The number of match groups in
discardRemainder: Boolean, whether to silently discard the last line if it was not properly terminated. Default:
These experimental options are planned but do not work reliably yet:
throughOpt: Options to pass through to
through2. Default: empty object.
obj: A shortcut for enabling
throughOpt. Boolean. Default:
combine: A function that merges the line with the match group(s) of its terminator. It will be called with one argument, a flat array of all these parts. Can also be
falseto pass on said array, auto-enabling the
objoption. Defaults to a function that can concat either buffers and strings.
- Needs more/better tests and docs.