Splits a string stream on a character (e.g. \n) and emits the strings in between.
npm install char-split
var split = require('char-split')
stream.pipe(
split()
.on('data', function(data) {
// line of text
})
.on('end', function(data) {
// end of stream
})
.on('error', function(error) {
// error in stream
})
)
Optional arguments:
split(character = '\n')
For simplicity, char-split doesn't support multi-character split strings. This means splitting on \r\n won't work.
Open source software under the zlib license.