pump-chain
A module that glues pump and bubble-stream-error to make life easier when piping streams internally and returning an outer stream.
what problem does it solve?
Consider the situation when you are piping multiple streams internally and returning an outer stream.
That stream will be handled by users of your module so you need to make sure that the errors coming from the internal streams propagate to the outer one (which bubble-stream-error
takes care of), otherwise they can't be caught and will blow up the process.
Also if one of the inner streams closes you want to make sure that the others get closed as well (which pump
does).
usage
Simply pass the streams you want to pipe together to pump-chain
.
var pump = ;var crypto = ;var fs = ;var zlib = ; { var gzip = zlib; var password = 'car cat tree fireman'; var aes = crypto; var rs = fs; // uncomment to simulate an error /* var i = 0; rs.on('data', function() { if (++i === 3) { this.emit('error', new Error('3 is unlucky!')); } }); */ return ;} ;
tests
npm test
related
mississippi stream utility collection which includes more useful stream modules similar to this one