# stream-exhaust

> Ensure that a stream is flowing data without mutating it

Latest version **1.0.2** (published 2017-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-exhaust
pnpm add stream-exhaust
yarn add stream-exhaust
bun add stream-exhaust
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-08-30 |
| First published | 2014-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Chris Dickinson |
| Maintainers | chrisdickinson |

## Links

- npm: https://www.npmjs.com/package/stream-exhaust
- Repository: https://github.com/chrisdickinson/stream-exhaust
- Homepage: https://github.com/chrisdickinson/stream-exhaust.git
- Issues: https://github.com/chrisdickinson/stream-exhaust.git
- npm.io page: https://npm.io/package/stream-exhaust

## Recent versions

- 1.0.2 (latest) — 2017-08-30
- 1.0.1 — 2015-01-19
- 1.0.0 — 2014-08-22

## README

# stream-exhaust

Ensure that the provided stream is flowing data, even if the stream hasn't been
piped to another stream.

```javascript
var exhaustively = require('stream-exhaust');

exhaustively(fs.createReadStream(__filename))
  .on('close', () => { console.log('all done, despite being streams{1+N}!') });
```

## Prior Art

This is based on [stream-consume](https://github.com/aroneous/stream-consume)
by [aroneous](https://github.com/aroneous). It is a separate package because it has
different semantics:

1. It does not call `.resume()` on streams2+ streams. streams2 streams monkeypatch `.pipe`
when entering flowing mode; avoiding `resume()` avoids that fate.
2. It does not examine `._readableState`; instead it checks for the presence of `._read`.

## API

### exhaust(Stream s) -> Stream s

Takes a stream, `s`, and returns it. Ensures that the stream is flowing, either by calling
`.resume()` if the stream is a streams1 stream, or by piping it to a "black hole" stream that
continually asks for more data.

## License

MIT

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