Usually when I pipe streams I want to destroy the source if the destination closes. Since pipe does not do that I kept repeating this
source .on('close', dest.destroy.bind(dest)) .on('error', dest.destroy.bind(dest)) .pipe(dest) .on('close', source.destroy.bind(source)) .on('error', source.destroy.bind(source)) I decided to do a small module that does this for me. It is called pump https://github.com/mafintosh/pump Using pump you can do the above like so var pump = require('pump'); pump(source, transform1, transform2, ..., dest, function(err) { console.log('pipe finished', err); }); It works with both 0.8 and 0.10 streams. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.