stream.pipeline()
A Node.js function that connects streams in a chain, handles backpressure, and destroys every stream in the chain if any of them fails.
In more detail
The promise version from node:stream/promises is awaited: await pipeline(source, transform, destination). Passing { signal } lets an AbortController cancel the whole chain.
Related terms
- pipe() — The Readable stream method that sends all its data into a Writable, pausing and resuming automatically to respect backpressure.
- backpressure — A slow consumer signalling a fast producer to pause, so data does not pile up in memory faster than it can be handled.
- AbortController — The standard JavaScript object for cancelling asynchronous work: its signal is handed to the work, and calling abort() cancels it.
- stream.destroy() — The method that closes a stream straight away, releasing its resources and optionally reporting an error.
Taught in
- Native Compression: node:zlib & Streaming Codecs — Node.js Internals & Backend Services
- Backpressure Engineering: Handling Mismatched I/O — Node.js Internals & Backend Services
- Stream Pipelines: pipeline, AbortSignal & Teardown — Node.js Internals & Backend Services