Node.js web streams - ReadableStream, WritableStream and pipeTo
Answer: Node.js includes an implementation of the WHATWG Streams Standard. A ReadableStream represents a source of streaming data, and a WritableStream represents a destination for streaming data. With pipeTo, this ReadableStream's data will be written to a WritableStream destination.
Examples
import { ReadableStream, TextDecoderStream } from 'node:stream/web';
const readable = new ReadableStream({
start(controller) {
controller.enqueue(new TextEncoder().encode('hello'));
controller.close();
},
});
const text = await new Response(readable).text();
const reader = readable.pipeThrough(new TextDecoderStream()).getReader();
Rules
- These are the same web streams used by
fetch. - These web streams are also what
fetchuses.
See also
Claims
- id: C1 claim: Node implements the WHATWG Streams Standard. source: S1 evidence: "An implementation of the WHATWG Streams Standard"
- id: C2 claim: A ReadableStream is a source of streaming data. source: S2 evidence: "Represents a source of streaming data"
- id: C3 claim: A WritableStream is a destination for streaming data. source: S2 evidence: "Represents a destination for streaming data"
Sources
- [S1] Web Streams API. Node.js API docs. https://nodejs.org/api/webstreams.html . License: MIT. Accessed 2026-11-18.
- [S2] doc/api/webstreams.md. nodejs/node (GitHub). https://github.com/nodejs/node/blob/main/doc/api/webstreams.md . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js API docs, Web Streams API; nodejs/node (GitHub), doc/api/webstreams.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Node.js API docs, Web Streams API; nodejs/node (GitHub), doc/api/webstreams.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors.
Cite this
iinventedlight. 2026. "Node.js web streams - ReadableStream, WritableStream and pipeTo." iinventedlight Library, iil:note:zr9trszf, version of 2026-11-18. https://iinventedlight.com/library/notes/node-webstreams/. License: CC-BY-4.0.
@misc{iil_note_zr9trszf,
author = {{iinventedlight}},
title = {{Node.js web streams - ReadableStream, WritableStream and pipeTo}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/node-webstreams/},
note = {Permanent ID iil:note:zr9trszf. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-webstreams.md.