A Web Streams API method that terminates a pipeline at a WritableStream. It returns a promise that resolves when piping completes, while managing backpressure, propagating errors, and cleaning up resources. section 10.4.4
const transformed = readable .pipeThrough(transformA) .pipeThrough(transformB); await transformed.pipeTo(writable);
Chain transformations with pipeThrough(), then await pipeTo() at the destination. section 10.4.4
The operational rules are:
- Treat the returned promise as the pipeline's completion and error boundary; an underlying source failure becomes a rejected promise. section 10.6.1
- Prefer built-in piping over manual forwarding: it coordinates producer and consumer speed across the buffers in the chain. section 10.3.3 section 10.8
- Keep a pipeline in one stream model when practical; crossing Node.js streams, Web Streams, and async iterables adds buffers, adapters, and scheduling overhead. section 10.8
A transformed Web Streams pipeline
const transformed = readable .pipeThrough(transformA) .pipeThrough(transformB); await transformed.pipeTo(writable); section 10.4.4
