2.0.1 • Published 5 years ago

pumpify v2.0.1

Weekly downloads
13,301,170
License
MIT
Repository
github
Last release
5 years ago

pumpify

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

build status

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.

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 duplexify you can also define the pipeline asynchronously using setPipeline(s1, s2, ...)

var untar = pumpify()

setTimeout(function() {
  // will start draining the input now
  untar.setPipeline(zlib.createGunzip(), tar.extract('output-folder'))
}, 1000)

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

License

MIT

Related

pumpify is part of the mississippi stream utility collection which includes more useful stream modules similar to this one.

mississippigcs-resumable-uploadfork-appcenter-clivuedragdropuploadimageskilli8n-react-native-fast-image@bitrelay/discovery@arisageha/react-lazyload@cashremit/cr-streamline-iconsvue-cli-evwtbb-chat@frxf/frxfelegant-sloth-turing@dxos/feed-level-indexer@dxos/data-client@parade/utils@fundefund/funde_ck@dattomy/docker-registry-servergql_din_mod@l1nyanm1ng/react-picture-viewerjs4cytoscapeyonggui@infinitebrahmanuniverse/nolb-pum@saaspe/components@everything-registry/sub-chunk-2493@simstudio/htmldiff@brucearmstrong/sass-librarylayui-customzzzxxxyyy321123react-picky-with-clearreact-otp-input-uptdqyx-hmtldiffrando-csvrangoli-cssraptor-appproxy-pumpifyprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4prova-2-carosellopublic-requirespull-httpqa_hddpxpreact-redux-demo1react-misc-toolboxreduce-groupsvelte-component-libstream-object2jsonstream-balancestreaming-birdtape-istanbulreact-form-component-libraryresponsive-react-apprethinkdb-validator-streamsnappy-msgpack-channelssnappy-msgpack-streamsipengine-modalsimply-uislither.iosmtrsolyd-gossipsplit-stream-lines-preserve-eol-pmbrunstreamsearch-index-addersand-google-storagesandblock-chain-sdk-jssecure-gossipregistry-migraterewrite-lockfiletabular-streamtailwindosupercluster-googlemaps-adapter-clonestest-carosello-campustenderminttendermint-insecuretransport-streamtravelbybit-binance-sdktwilio-streamtesting-storybooktestapatldrawlignintextfield-sampletingzi-vuepresstinymce-plugin-toytype-libarys3strun-electronsam-carouselsamc2samc3samc4samc5sequelcomponentserialize-streamregression-external-dtoreproject-streamreyhan-projectshader-reloadshaina
2.0.1

5 years ago

2.0.0

5 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.6

6 years ago

1.3.5

8 years ago

1.3.4

8 years ago

1.3.3

10 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.0

10 years ago