Node.js streams - pipeline, finished and objectMode
Answer: The node:stream module is an API for implementing the stream interface. Node.js ships many stream objects. pipeline from node:stream/promises hooks readable, transform, and writable streams together.
Examples
import { pipeline } from 'node:stream/promises';
import { createReadStream, createWriteStream } from 'node:fs';
import { createGzip } from 'node:zlib';
await pipeline(
createReadStream('in.txt'),
createGzip(),
createWriteStream('out.txt.gz'),
);
Rules
- HTTP requests and
process.stdoutare both stream instances. objectModemay be set when the stream is created if you need to emit non-buffer values.
See also
Claims
- id: C1 claim: node:stream provides an API for the stream interface. source: S1 evidence: "The node:stream module provides an API for implementing the stream interface"
- id: C2 claim: The same stream interface is documented in the Node.js source docs. source: S2 evidence: "The
node:streammodule provides an API for implementing the stream interface"
- id: C3 claim: Node.js ships many stream objects. source: S1 evidence: "There are many stream objects provided by Node.js"
Sources
- [S1] Stream. Node.js API docs. https://nodejs.org/api/stream.html . License: MIT. Accessed 2026-11-18.
- [S2] doc/api/stream.md. nodejs/node (GitHub). https://github.com/nodejs/node/blob/main/doc/api/stream.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, Stream; nodejs/node (GitHub), doc/api/stream.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, Stream; nodejs/node (GitHub), doc/api/stream.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors.
Cite this
iinventedlight. 2026. "Node.js streams - pipeline, finished and objectMode." iinventedlight Library, iil:note:ytd6q6nw, version of 2026-11-18. https://iinventedlight.com/library/notes/node-stream/. License: CC-BY-4.0.
@misc{iil_note_ytd6q6nw,
author = {{iinventedlight}},
title = {{Node.js streams - pipeline, finished and objectMode}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/node-stream/},
note = {Permanent ID iil:note:ytd6q6nw. 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-stream.md.