pipe()
The Readable stream method that sends all its data into a Writable, pausing and resuming automatically to respect backpressure.
In more detail
pipe() does not forward errors or destroy the other streams when one fails, which can leak file descriptors and memory. pipeline() fixes that and is preferred.
Related terms
- 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.
- backpressure — A slow consumer signalling a fast producer to pause, so data does not pile up in memory faster than it can be handled.
- resource leak — A file, socket, timer or other system resource that a program opened and never closed.
Taught in
- Stream Mechanics: Readable Streams & Flowing Modes — 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