pipeThrough() connects a Web ReadableStream to a TransformStream and returns the transform's readable side, allowing another stage to continue the chain. It also coordinates backpressure, propagates errors, and cleans up pipeline resources. section 10.4.4
A common failure occurs when a fetch() response is sent into a Node.js transform: fetch() exposes a Web Stream, while native Node.js HTTP APIs use Node.js streams. Convert at the boundary with Readable.fromWeb(), or remain in Web Streams and use pipeThrough(); repeated conversions add adaptation, buffering, scheduling, and performance costs. section 10.4.2 section 10.8
Chaining transforms
const transformed = readable .pipeThrough(transformA) .pipeThrough(transformB); await transformed.pipeTo(writable); section 10.4.4
Prefer built-in piping over manual forwarding loops or extracted controllers. The built-in operations preserve backpressure and coordinated cleanup; manual pushing can defeat backpressure. Await the eventual pipeTo() promise so Web Stream failures surface as rejected promises rather than disappearing or becoming unhandled rejections. section 10.6.1 section 10.8
const transformed = readable .pipeThrough(transformA) .pipeThrough(transformB); await transformed.pipeTo(writable);
Shows the compact chaining pattern for placing multiple TransformStreams between a readable source and a writable destination. section 10.4.4
