Skip to content

A combination of through2 and split with a straightforward interface.

Notifications You must be signed in to change notification settings

alessioalex/split-transform-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

split-transform-stream

A combination of through2 and split with a straightforward interface.

build status

Usage

splitStream(inputStream, write, [end], [splitText])

returns a stream

Example

var readStream = require('fs').createReadStream(__filename, 'utf8');
var splitStream = require('./index');
var write = function(line, encoding, next) {
  this.push(line.split(' ').reverse().join(' '));

  next();
};

// emitting lines in reverse
splitStream(readStream, write).on('data', function(data) {
  console.log(data);
}).on('error', function(err) {
  if (err) { throw err; }
}).on('end', function() {
  console.log('done');
});

License

MIT

About

A combination of through2 and split with a straightforward interface.

Resources

Stars

Watchers

Forks

Packages

No packages published