# @simple-libs/stream-utils

> A small set of utilities for streams.

Latest version **2.0.0** (published 2026-06-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @simple-libs/stream-utils
pnpm add @simple-libs/stream-utils
yarn add @simple-libs/stream-utils
bun add @simple-libs/stream-utils
```

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-06-25 |
| First published | 2025-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 0 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dan Onoshko |
| Maintainers | dangreen |
| Keywords | stream, streams, utilities, utils |

## Links

- npm: https://www.npmjs.com/package/@simple-libs/stream-utils
- Repository: https://github.com/TrigenSoftware/simple-libs
- Homepage: https://github.com/TrigenSoftware/simple-libs/tree/main/packages/stream-utils#readme
- Issues: https://github.com/TrigenSoftware/simple-libs/issues
- Funding: https://ko-fi.com/dangreen
- npm.io page: https://npm.io/package/@simple-libs/stream-utils

## 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.0 (latest) — 2026-06-25
- 1.2.0 — 2026-03-01
- 1.1.0 — 2025-06-01
- 1.0.0 — 2025-05-28

## README

# @simple-libs/stream-utils

[![ESM-only package][package]][package-url]
[![NPM version][npm]][npm-url]
[![Node version][node]][node-url]
[![Dependencies status][deps]][deps-url]
[![Install size][size]][size-url]
[![Build status][build]][build-url]
[![Coverage status][coverage]][coverage-url]

[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
[package-url]: https://nodejs.org/api/esm.html

[npm]: https://img.shields.io/npm/v/@simple-libs/stream-utils.svg
[npm-url]: https://www.npmjs.com/package/@simple-libs/stream-utils

[node]: https://img.shields.io/node/v/@simple-libs/stream-utils.svg
[node-url]: https://nodejs.org

[deps]: https://img.shields.io/librariesio/release/npm/@simple-libs/stream-utils
[deps-url]: https://libraries.io/npm/@simple-libs%2Fstream-utils

[size]: https://packagephobia.com/badge?p=@simple-libs/stream-utils
[size-url]: https://packagephobia.com/result?p=@simple-libs/stream-utils

[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/simple-libs/tests.yml?branch=main
[build-url]: https://github.com/TrigenSoftware/simple-libs/actions

[coverage]: https://coveralls.io/repos/github/TrigenSoftware/simple-libs/badge.svg?branch=main
[coverage-url]: https://coveralls.io/github/TrigenSoftware/simple-libs?branch=main

A small set of utilities for streams.

## Install

```bash
# pnpm
pnpm add @simple-libs/stream-utils
# yarn
yarn add @simple-libs/stream-utils
# npm
npm i @simple-libs/stream-utils
```

## Usage

```ts
import {
  toArray,
  concatBufferStream,
  concatStringStream,
  firstFromStream,
  mergeReadables
} from '@simple-libs/stream-utils'

// Convert a readable stream to an array
await toArray(Readable.from(['foo', 'bar', 'baz']))
// Returns ['foo', 'bar', 'baz']

// Concatenate a stream of buffers into a single buffer
await concatBufferStream(Readable.from([Buffer.from('foo'), Buffer.from('bar')]))
// Returns <Buffer 66 6f 6f 62 61 72>

// Concatenate a stream of strings into a single string
await concatStringStream(Readable.from(['foo', 'bar']))
// Returns 'foobar'

// Get the first value from a stream
await firstFromStream(Readable.from(['foo', 'bar']))
// Returns 'foo'

// Merges multiple Readable streams into a single Readable stream.
// Each chunk will be an object containing the source stream name and the chunk data.
await mergeReadables({
  foo: Readable.from(['foo1', 'foo2']),
  bar: Readable.from(['bar1', 'bar2'])
})
// Returns [{ source: 'foo', chunk: 'foo1' }, { source: 'foo', chunk: 'foo2' }, { source: 'bar', chunk: 'bar1' }, { source: 'bar', chunk: 'bar2' }]
```

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