Tell me how a Transform stream actually works under the hood. And when would you just write a for await loop over a readable instead of building out a pipeline?
A strong answer gets Transform's two-sided buffering, treats the callback as the backpressure lever, and knows what for-await does to a stream on early exit
A Transform stream is a duplex stream where you implement _transform(chunk, encoding, callback). Data written to the writable side comes into your function, you do your processing, push() the results out to the readable side, and call the callback to say you're ready for the next chunk. Compression streams and parsers are the textbook examples, I think. The other way to consume a readable is async iteration, so for await (const chunk of stream) pulls chunks one at a time. And because you only pull after your loop body finishes, backpressure kind of just works, the stream won't run ahead of your processing. It reads like normal sequential code, error handling is a regular try/catch, and from what I've seen it's the recommended style for consuming streams when you don't actually need a full pipeline of stages.