1 | # pumpify
|
2 |
|
3 | Combine an array of streams into a single duplex stream using [pump](https://github.com/mafintosh/pump) and [duplexify](https://github.com/mafintosh/duplexify).
|
4 | If one of the streams closes/errors all streams in the pipeline will be destroyed.
|
5 |
|
6 | ```
|
7 | npm install pumpify
|
8 | ```
|
9 |
|
10 | ## Usage
|
11 |
|
12 | Pass the streams you want to pipe together to pumpify `pipeline = pumpify(s1, s2, s3, ...)`.
|
13 | `pipeline` is a duplex stream that writes to the first streams and reads from the last one.
|
14 | Streams are piped together using [pump](https://github.com/mafintosh/pump) so if one of them closes
|
15 | all streams will be destroyed.
|
16 |
|
17 | ``` js
|
18 | var pumpify = require('pumpify')
|
19 | var tar = require('tar-fs')
|
20 | var zlib = require('zlib')
|
21 | var fs = require('fs')
|
22 |
|
23 | var untar = pumpify(zlib.createGunzip(), tar.extract('output-folder'))
|
24 |
|
25 | fs.createReadStream('some-gzipped-tarball.tgz').pipe(untar)
|
26 | ```
|
27 |
|
28 | If you are pumping object streams together use `pipeline = pumpify.obj(s1, s2, ...)`.
|
29 | Call `pipeline.destroy()` to destroy the pipeline (including the streams passed to pumpify).
|
30 |
|
31 | ## License
|
32 |
|
33 | MIT |
\ | No newline at end of file |