linerstream

Split a readable stream by newline characters

linerstream

Split a readable stream by newline characters

Installation

npm install -S linerstream

Usage

Create an instance of linestream and pipe a readable stream into that instance

var Linerstream = require('linerstream')
// splitter is an instance of require('stream').Transform 
var opts = {
  highWaterMark: 2
}
var splitter = new Linerstream(opts) // opts is optional 
 
var readStream = fs.createReadStream('/file/with/line/breaks.txt')
var lineByLineStream = readStream.pipe(splitter)
lineByLineStream.on('data', function(chunk) {
  console.dir(chunk)  // no line breaks here :) 
})