githubEdit

pumpify

Combine an array of streams into a single duplex stream using pumparrow-up-right and duplexifyarrow-up-right. If one of the streams closes/errors all streams in the pipeline will be destroyed.

npm install pumpify

build statusarrow-up-right

Usage

Pass the streams you want to pipe together to pumpify pipeline = pumpify(s1, s2, s3, ...). pipeline is a duplex stream that writes to the first streams and reads from the last one. Streams are piped together using pumparrow-up-right so if one of them closes all streams will be destroyed.

var pumpify = require('pumpify')
var tar = require('tar-fs')
var zlib = require('zlib')
var fs = require('fs')

var untar = pumpify(zlib.createGunzip(), tar.extract('output-folder'))
// you can also pass an array instead
// var untar = pumpify([zlib.createGunzip(), tar.extract('output-folder')])

fs.createReadStream('some-gzipped-tarball.tgz').pipe(untar)

If you are pumping object streams together use pipeline = pumpify.obj(s1, s2, ...). Call pipeline.destroy() to destroy the pipeline (including the streams passed to pumpify).

Using setPipeline(s1, s2, ...)

Similar to duplexifyarrow-up-right you can also define the pipeline asynchronously using setPipeline(s1, s2, ...)

License

MIT

pumpify is part of the mississippi stream utility collectionarrow-up-right which includes more useful stream modules similar to this one.

Last updated