# stream-read-all

> Returns a promise which fulfils with the supplied stream's content

Latest version **5.0.2** (published 2024-10-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-read-all
pnpm add stream-read-all
yarn add stream-read-all
bun add stream-read-all
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.2 |
| Published | 2024-10-18 |
| First published | 2017-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12.20 |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lloyd Brookes |
| Maintainers | 75lb |
| Keywords | concat, stream, read, all, collect, buffers, concatenate |

## Links

- npm: https://www.npmjs.com/package/stream-read-all
- Repository: https://github.com/75lb/stream-read-all
- Homepage: https://github.com/75lb/stream-read-all#readme
- Issues: https://github.com/75lb/stream-read-all/issues
- npm.io page: https://npm.io/package/stream-read-all

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

- 5.0.2 (latest) — 2024-10-18
- 5.0.1 — 2024-10-17
- 5.0.0 — 2024-10-17
- 4.0.0 — 2023-03-19
- 3.0.1 — 2020-10-05
- 3.0.0 — 2020-04-01
- 2.0.0 — 2019-05-20
- 1.0.1 — 2018-06-13
- 1.0.0 — 2018-06-13
- 0.1.2 — 2017-08-09
- 0.1.1 — 2017-06-29
- 0.1.0 — 2017-06-18

## README

[![view on npm](https://badgen.net/npm/v/stream-read-all)](https://www.npmjs.org/package/stream-read-all)
[![npm module downloads](https://badgen.net/npm/dt/stream-read-all)](https://www.npmjs.org/package/stream-read-all)
[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/stream-read-all)](https://github.com/75lb/stream-read-all/network/dependents?dependent_type=REPOSITORY)
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/stream-read-all)](https://github.com/75lb/stream-read-all/network/dependents?dependent_type=PACKAGE)
[![Node.js CI](https://github.com/75lb/stream-read-all/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/stream-read-all/actions/workflows/node.js.yml)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

# stream-read-all

Returns a promise which fulfils with the supplied stream's content. Supports any [Readable](https://nodejs.org/docs/latest/api/stream.html#readable-streams) stream as input in either regular or [object mode](https://nodejs.org/docs/latest/api/stream.html#object-mode).

For example, this script...

```js
import { streamReadAll } from 'stream-read-all'
const readable = await streamReadAll(process.stdin)
console.log(readable.toString())
```

...prints this output.

```
$ echo Hello | node example.js
Hello
```

The above `streamReadAll` function returns either a `Buffer` in regular mode or an array of objects in object mode. Alternatively, you can use `streamReadText` which is identical to the above except it returns text. The second argument is optional, specifying the character encoding to use (as in the [buffer.toString()](https://nodejs.org/docs/latest/api/buffer.html#buftostringencoding-start-end) first argument). The default value is 'utf8'.

```js
import { streamReadText } from 'stream-read-all'
const readable = fs.createReadStream('./package.json')
const text = await streamReadText(readable, 'hex')
console.log(text)
// prints the package.json file content in hex format
```

* * *

&copy; 2017-25 Lloyd Brookes <opensource@75lb.com>.

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