readable-stream

A standalone, spec-accurate copy of Node.js core streams for consistent behavior across Node versions and in browsers.

Library
npm
v4.7.0
1,048stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
52/100Fair
Development Activity0
Maintenance32
Community88
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
69/100Good
Architecture70
Code Quality80
Innovation55
Learning Curve70

readable-stream is the Node.js Streams Working Group’s userland mirror of the stream classes that ship inside Node core itself — Readable, Writable, Duplex, Transform, PassThrough, plus the pipeline/finished/compose helpers. Instead of hand-maintaining a separate implementation, the project extracts the actual stream internals from a pinned Node.js release tarball and rewrites Node’s internal primordials into userland-safe equivalents, so the published package behaves identically to whatever Node version it was cut from.

This lets any library or application require('readable-stream') in place of the built-in stream module and get guaranteed-consistent, spec-correct stream behavior regardless of which Node.js version end users are running — or none at all, since the same code also runs in browsers via bundlers like webpack, browserify, and rollup. It is one of the most widely depended-on packages in the npm ecosystem precisely because it removes stream-behavior drift as a source of bugs.

What You Get

  • Drop-in Readable, Writable, Duplex, Transform, and PassThrough classes that match Node core’s implementation exactly
  • The pipeline, finished, addAbortSignal, and compose helper functions ported alongside the classes
  • A stream/promises equivalent (lib/stream/promises.js) for async/await-based stream consumption
  • Browser compatibility via a browser field mapping to polyfilled builds, verified against webpack, rollup, and browserify
  • An opt-out escape hatch (READABLE_STREAM=disable env var) that falls back to the host’s native stream module when userland behavior isn’t needed

Common Use Cases

  • Libraries that need guaranteed-consistent stream behavior across the full range of Node versions their users might run
  • Front-end bundles that need Node-compatible stream classes in a browser environment
  • Legacy codebases pinned to older Node versions that still want current stream semantics and bug fixes
  • Tooling authors who want stream error codes and edge-case behavior to match Node core exactly, rather than reimplementing it

Under The Hood

Architecture The entry point (src/index.js, built to lib/ours/index.js) either re-exports the host’s native stream module (when READABLE_STREAM=disable) or the userland implementation, which mirrors Node core’s own layering: a base Stream class extended by Readable, Writable, Duplex, and Transform in lib/internal/streams/*.js, with shared internals (buffer_list.js, state.js, utils.js) and combinator/compat layers (compose.js, pipeline.js, end-of-stream.js, duplexify.js, legacy.js) sitting on top. Nothing here is architected from scratch for this package — build/build.mjs downloads a pinned Node.js release tarball, extracts the matching internal stream sources via regex (build/files.mjs), and rewrites Node’s internal primordials into userland-safe equivalents via scripted replacements (build/replacements.mjs), so a change to any core abstraction ripples through the same dependent files it would ripple through inside Node itself.

Tech Stack Plain CommonJS JavaScript with no TypeScript, targeting Node >=12 and evergreen browsers. Runtime dependencies (abort-controller, buffer, events, process, string_decoder) are polyfills that stand in for Node built-ins on older runtimes and in browsers. The build pipeline is unusual for an npm library: undici fetches the Node release tarball, tar extracts it, @babel/core and scripted replacements adapt the source, and prettier formats the output — a source-sync tool more than a conventional bundler-based build. Cross-environment compatibility is exercised via webpack, rollup, browserify, and playwright in dedicated test:bundlers/test:browsers scripts.

Code Quality The test suite under test/parallel is ported directly from Node core’s own stream tests, run through tap with c8 coverage, supplemented by package-specific tests under test/ours (error codes, fake timers, synchronous writes). CI (.github/workflows/node.yml, browsers.yml, bundlers.yml, lint.yml) covers multiple Node versions, bundler/browser compatibility, and linting via eslint-config-standard. There is no static type system — correctness leans entirely on the inherited Node core test suite and its own error-code discipline (ERR_* classes in src/errors.js) rather than types.

What Makes It Unique Most npm packages that vendor upstream code do so by hand; readable-stream instead has a repeatable, scripted resync pipeline that re-derives its entire implementation from an actual Node.js release tarball rather than reimplementing stream semantics independently. The value it delivers isn’t a new API — it deliberately mirrors Node’s stream module exactly — but a maintenance mechanism that keeps a userland shim provably in sync with upstream Node core across a very wide compatibility matrix.

Used by 8 apps in this directory

Rust
67%
MIT

Bun

Developer Tools

95,895

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
64
Dependency
Built with
Rust67%
C++19%
Updated yesterday
TypeScript
98%
Apache 2.0

Codebuff

AI Code Assistants

11,750

An open-source AI coding assistant that coordinates specialized agents to edit your codebase from natural language — including Freebuff, a free, ad-supported version powered entirely by open-source models like DeepSeek and Kimi.

View details
85
Repo Health
71
Technical
67
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,772

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript75%
Updated yesterday
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,586

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
89
Repo Health
86
Technical
62
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
TypeScript
98%
Other

Orama

Search · Developer Tools

10,547

A complete, embeddable search engine and RAG pipeline running in browsers, servers, and edge networks with full-text, vector, and hybrid search in under 2KB.

View details
74
Repo Health
83
Technical
68
Dependency
Built with
TypeScript98%
Updated 1 months ago
Rust
71%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,116

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
86
Repo Health
81
Technical
65
Dependency
Built with
Rust71%
TypeScript25%
Updated yesterday
Rust
93%
Other

Tabby

AI Code Assistants

33,868

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
60
Repo Health
78
Technical
61
Dependency
Built with
Rust93%
Updated 2 months ago
TypeScript
98%
Apache 2.0

TinaCMS

CMS

13,780

An open-source, Git-backed headless CMS that gives editors a live visual editing UI over Markdown, MDX, JSON, and YAML content while developers keep everything in version control.

View details
92
Repo Health
74
Technical
59
Dependency
Built with
TypeScript98%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search