pipe-io

Pipe streams and handle events

Pipe-io

Pipe streams and handle events.

npm i pipe-io --save

Create pipe between streams and adds callback wich would be called once whenever everything is done, or error occures.

var pipe        = require('pipe-io'),
    fs          = require('fs'),
    NAME        = 'README.md',
    NAME2       = 'README2.md',
    readStream  = fs.createReadStream(NAME),
    writeStream = fs.createWritesStream(NAME2);
 
pipe([readStream, writeStream], function(error) {
    console.log(error || 'done');
});

Get body of readStream

var pipe        = require('pipe-io'),
    fs          = require('fs'),
    NAME        = 'README.md',
    readStream  = fs.createReadStream(NAME);
 
pipe.getBody(readStream, function(errordata) {
    console.log(error || data);
});

MIT