← All notes

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

See also

Claims

Sources

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

Permanent ID: iil:note:zr9trszf

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.},
}

Markdown

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.