# pumpify

> Combine an array of streams into a single duplex stream using pump and duplexify

Latest version **2.0.1** (published 2019-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install pumpify
pnpm add pumpify
yarn add pumpify
bun add pumpify
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2019-10-01 |
| First published | 2014-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/pumpify) |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 252 |
| Author | Mathias Buus |
| Maintainers | mafintosh |
| Keywords | pump, duplexify, duplex, streams, stream, pipeline, combine |

## Links

- npm: https://www.npmjs.com/package/pumpify
- Repository: https://github.com/mafintosh/pumpify
- Issues: https://github.com/mafintosh/pumpify/issues
- npm.io page: https://npm.io/package/pumpify

## Dependencies (3)

- [pump](https://npm.io/package/pump.md) ^3.0.0
- [inherits](https://npm.io/package/inherits.md) ^2.0.3
- [duplexify](https://npm.io/package/duplexify.md) ^4.1.1

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2019-10-01
- 2.0.0 — 2019-06-12
- 1.5.1 — 2018-05-16
- 1.5.0 — 2018-05-04
- 1.4.0 — 2018-01-17
- 1.3.6 — 2018-01-10
- 1.3.5 — 2016-06-14
- 1.3.4 — 2016-02-23
- 1.3.3 — 2014-09-24
- 1.3.2 — 2014-08-15
- 1.3.1 — 2014-08-15
- 1.3.0 — 2014-08-07
- 1.2.1 — 2014-07-25
- 1.2.0 — 2014-07-23
- 1.1.3 — 2014-07-23
- … 7 more at https://npm.io/package/pumpify/versions

## README

# pumpify

Combine an array of streams into a single duplex stream using [pump](https://github.com/mafintosh/pump) and [duplexify](https://github.com/mafintosh/duplexify).
If one of the streams closes/errors all streams in the pipeline will be destroyed.

```
npm install pumpify
```

[![build status](http://img.shields.io/travis/mafintosh/pumpify.svg?style=flat)](http://travis-ci.org/mafintosh/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](https://github.com/mafintosh/pump) so if one of them closes
all streams will be destroyed.

``` js
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](https://github.com/mafintosh/duplexify) you can also define the pipeline asynchronously using `setPipeline(s1, s2, ...)`

``` js
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](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.

---
_Source: https://npm.io/package/pumpify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
