# it-byte-stream

> Read and write arbitrary bytes over a duplex stream

Latest version **3.0.0** (published 2026-05-08) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install it-byte-stream
pnpm add it-byte-stream
yarn add it-byte-stream
bun add it-byte-stream
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2026-05-08 |
| First published | 2023-07-03 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 5 |
| Unpacked size | 75.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 284 |
| Author | Alex Potsides |
| Maintainers | achingbrain |

## Links

- npm: https://www.npmjs.com/package/it-byte-stream
- Repository: https://github.com/achingbrain/it
- Homepage: https://github.com/achingbrain/it/tree/main/packages/it-byte-stream#readme
- Issues: https://github.com/achingbrain/it/issues
- npm.io page: https://npm.io/package/it-byte-stream

## Dependencies (5)

- [abort-error](https://npm.io/package/abort-error.md) ^1.0.2
- [race-signal](https://npm.io/package/race-signal.md) ^2.0.0
- [uint8arraylist](https://npm.io/package/uint8arraylist.md) ^3.0.1
- [it-stream-types](https://npm.io/package/it-stream-types.md) ^2.0.2
- [it-queueless-pushable](https://npm.io/package/it-queueless-pushable.md) ^2.0.0

## Recent versions

- 3.0.0 (latest) — 2026-05-08
- 2.0.6 — 2026-04-10
- 2.0.5 — 2026-04-10
- 2.0.4 — 2025-12-12
- 2.0.3 — 2025-06-01
- 2.0.2 — 2025-05-13
- 2.0.1 — 2025-03-19
- 2.0.0 — 2025-03-19
- 1.1.1 — 2025-03-06
- 1.1.0 — 2024-08-08
- 1.0.12 — 2024-05-30
- 1.0.11 — 2024-05-30
- 1.0.10 — 2024-04-25
- 1.0.9 — 2024-04-24
- 1.0.8 — 2024-02-07
- … 9 more at https://npm.io/package/it-byte-stream/versions

## README

# it-byte-stream

[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it)
[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/it/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/achingbrain/it/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> Read and write arbitrary bytes over a duplex stream

# About

<!--

!IMPORTANT!

Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.

To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts

To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.

-->

This module makes it easy to send and receive bytes over streams.

## Example

```typescript
import { byteStream } from 'it-byte-stream'

const stream = byteStream(duplex)

// read the next chunk
const bytes = await stream.read()

// read the next five bytes
const fiveBytes = await stream.read(5)

// write bytes into the stream
await stream.write(Uint8Array.from([0, 1, 2, 3, 4]))
```

# Install

```console
$ npm i it-byte-stream
```

## Browser `<script>` tag

Loading this module through a script tag will make its exports available as `ItByteStream` in the global namespace.

```html
<script src="https://unpkg.com/it-byte-stream/dist/index.min.js"></script>
```

# API Docs

- <https://achingbrain.github.io/it/modules/it-byte-stream.html>

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](https://github.com/achingbrain/it/blob/main/packages/it-byte-stream/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/achingbrain/it/blob/main/packages/it-byte-stream/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

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