# collect-stream

> Collect a readable stream's output and errors

Latest version **1.2.1** (published 2016-09-12) · MIT license · 0 weekly downloads

## Install

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

## 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.2.1 |
| Published | 2016-09-12 |
| First published | 2013-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Julian Gruber |
| Maintainers | juliangruber |
| Keywords | collect, stream, concat |

## Links

- npm: https://www.npmjs.com/package/collect-stream
- Repository: https://github.com/juliangruber/collect-stream
- Issues: https://github.com/juliangruber/collect-stream/issues
- npm.io page: https://npm.io/package/collect-stream

## Dependencies (2)

- [once](https://npm.io/package/once.md) ^1.3.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.2.0

## 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

- 1.2.1 (latest) — 2016-09-12
- 1.2.0 — 2016-09-12
- 1.1.1 — 2015-08-27
- 1.1.0 — 2015-08-27
- 1.0.0 — 2014-08-08
- 0.0.0 — 2013-11-19

## README

# collect-stream

Collect a readable stream's output and errors.

[![build status](https://secure.travis-ci.org/juliangruber/collect-stream.png)](http://travis-ci.org/juliangruber/collect-stream)

## Usage

Give it a readable stream and a function and it will call latter with the
potential error and a smart representation of the data the stream emitted.

```js
import collect from 'collect-stream';

collect(stringStream, (err, data) => {
  console.log(data); // one string
});

collect(bufferStream, (err, data) => {
  console.log(data); // one buffer
});

collect(objectStream, (err, data) => {
  console.log(data); // an array of objects
});
```

Give it options and it will pass them to [concat-stream](https://github.com/maxogden/concat-stream/).

```js
import collect from 'collect-stream';

collect(someStream, {
  encoding: 'object'
}, (err, data) => {
  console.log(data) // forced to be an array of objects
});
```

## Installation

```bash
$ npm install collect-stream
```

## License

  MIT

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