ReadlineTransform
Reading String or Buffer content from a Readable stream and writing each line which ends without line break as object
Install
$ npm install -save readline-transform
How to Use
Create a ReadlineTransform
new ReadlineTransform(options)
options
<Object>
breakMatcher
is the regular expression to split content by line break forstr.split()
. (default:/\r?\n/
)ignoreEndOfBreak
is boolean. if content ends with line break, ignore last empty line. (default:true
)skipEmpty
is boolean. if line is empty string, skip it (default:false
)
An example
const PassThrough = ;const ReadlineTransform = ; const readStream = ;const transform = skipEmpty: true ;const writeStream = objectMode: true ; writeStream; readStream; readStream;readStream;readStream;
Console output
$ node example.js
foo
bar
baz
<<< all done >>>