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,048 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
52 /100 Fair
Development Activity 0
Maintenance 32
Community 88
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
69 /100 Good
Architecture 70
Code Quality 80
Innovation 55
Learning Curve 70

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 9 apps in this directory

Rust
67%
MIT

Bun

Developer Tools

96,068

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
Rust 67%
C++ 19%
TypeScript 10%
Updated 5 days ago
TypeScript
99%
Apache 2.0

Codebuff

AI Code Assistants

12,842

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
TypeScript 99%
Updated 4 days ago
TypeScript
96%
MIT

deepseek-harness

AI Agents · AI Development · Developer Tools

237,945

An open-source, plugin-based agent harness from DeepSeek AI that runs coding and automation agents across web, desktop, CLI, and SDK surfaces.

View details
81
Repo Health
89
Technical
74
Dependency
Built with
TypeScript 96%
Updated 5 days ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

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
TypeScript 75%
Updated 4 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,797

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

View details
90
Repo Health
86
Technical
62
Dependency
Built with
TypeScript 61%
Svelte 34%
Updated 6 days ago
TypeScript
98%
Other

Orama

Developer Tools · Search

10,565

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
68
Repo Health
83
Technical
64
Dependency
Built with
TypeScript 98%
Updated 3 weeks ago
Rust
72%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,195

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
64
Dependency
Built with
Rust 72%
TypeScript 25%
Updated 6 days ago
Rust
93%
Other

Tabby

AI Code Assistants

33,892

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

View details
58
Repo Health
78
Technical
61
Dependency
Built with
Rust 93%
Updated 3 months ago
TypeScript
98%
Apache 2.0

TinaCMS

CMS

13,811

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
TypeScript 98%
Updated 4 days ago

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