0.2.0 • Published 13 years ago
split-stream v0.2.0
split-stream 
stream of split strings
Installation
$ npm install split-streamUsage
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);Functions
create(options)
optionsobject - option objectreturnSplitStream - SplitStream
throw TypeError if options.splitStr is not string or regexp types.
options
splitStrstring or regexp - split string
default value is /\r?\n/.
Events
close
called destroy().
data
datastring - split string
drain
when buffer is empty.
end
call after end() and when buffer is empty.
error
errorError - error object
call twice destory() or call write() after end().
Test
$ npm install
$ npm testLicense
The MIT License. Please see LICENSE file.