# read-all-stream

> Read all stream content and pass it to callback

Latest version **3.1.0** (published 2016-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install read-all-stream
pnpm add read-all-stream
yarn add read-all-stream
bun add read-all-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 | 3.1.0 |
| Published | 2016-01-27 |
| First published | 2014-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Vsevolod Strukchinsky |
| Maintainers | floatdrop |
| Keywords | stream, read, buffer, callback |

## Links

- npm: https://www.npmjs.com/package/read-all-stream
- Repository: https://github.com/floatdrop/read-all-stream
- Issues: https://github.com/floatdrop/read-all-stream/issues
- npm.io page: https://npm.io/package/read-all-stream

## Dependencies (2)

- [pinkie-promise](https://npm.io/package/pinkie-promise.md) ^2.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^2.0.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

- 3.1.0 (latest) — 2016-01-27
- 3.0.1 — 2015-07-18
- 3.0.0 — 2015-07-01
- 2.2.0 — 2015-06-22
- 2.1.2 — 2015-04-07
- 2.1.1 — 2015-04-07
- 2.1.0 — 2015-04-07
- 2.0.0 — 2015-04-01
- 1.0.2 — 2015-01-29
- 1.0.1 — 2015-01-19
- 1.0.0 — 2015-01-19
- 0.2.0 — 2015-01-19
- 0.1.2 — 2014-11-09
- 0.1.1 — 2014-11-09
- 0.1.0 — 2014-11-09

## README

# read-all-stream [![Build Status][travis-image]][travis-url]

> Read stream to buffer or string

## Install

```
$ npm install --save read-all-stream
```

## Usage

```js
var read = require('read-all-stream');
var stream = fs.createReadStream('index.js');

read(stream).then(function (data) {
	console.log(data.length);
});

read(stream, 'utf8', function (err, data) {
	console.log(data.length);
	//=> 42
});

```

### API

#### read(stream, [options], [callback])

If callback is omitted, Promise will be returned.

##### stream

*Required*  
Type: `Stream`

Event emitter, which `data` events will be consumed.

##### options

Type: `object` or `string`

If type of `options` is `string`, then it will be used as encoding.
If type is `Object`, then next options are available:

##### options.encoding

Type: `string`, `null`  
Default: `'utf8'`

Encoding to be used on `toString` of the data. If null, the body is returned as a Buffer.

##### callback(err, data)

Will be called after stream is read.

###### err

`Error` object (if `error` event happens).

###### data

The data in stream.

## License

MIT © [Vsevolod Strukchinsky](floatdrop@gmail.com)

[travis-url]: https://travis-ci.org/floatdrop/read-all-stream
[travis-image]: https://img.shields.io/travis/floatdrop/read-all-stream.svg

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