You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combine an array of streams into a single duplex stream using pump and duplexify.
If one of the streams closes/errors all streams in the pipeline will be destroyed.
npm install pumpify
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 pump so if one of them closes
all streams will be destroyed.
varpumpify=require('pumpify')vartar=require('tar-fs')varzlib=require('zlib')varfs=require('fs')varuntar=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 duplexify you can also define the pipeline asynchronously using setPipeline(s1, s2, ...)
varuntar=pumpify()setTimeout(function(){// will start draining the input nowuntar.setPipeline(zlib.createGunzip(),tar.extract('output-folder'))},1000)fs.createReadStream('some-gzipped-tarball.tgz').pipe(untar)