split-stream

stream of split strings

split-stream

stream of split strings

$ npm install split-stream
var fs = require('fs'),
    splitStream = require('split-stream'),
    ss = splitStream.create();
 
fs.createReadStream('./file').pipe(ss).pipe(process.stdout);
var fs = require('fs'),
    splitStream = require('split-stream'),
    ss = splitStream.create();
 
ss.setEncoding('utf8');
 
ss.on('data', function(data) {
  console.log(data);
});
ss.on('end', function() {
  ss.destory();
});
ss.on('close', function() {
  console.log('close');
});
 
fs.createReadStream('./file').pipe(ss);
  • options object - option object

  • return SplitStream - SplitStream

throw TypeError if options.splitStr is not string or regexp types.

  • splitStr string or regexp - split string

default value is /\r?\n/.

called destroy().

  • data string - split string

when buffer is empty.

call after end() and when buffer is empty.

  • error Error - error object

call twice destory() or call write() after end().

$ npm install
$ npm test

The MIT License. Please see LICENSE file.