Re: [whatwg/streams] Handeling backpressure on the Readable side of a transform stream (Issue #1323)

jedwards1211 left a comment (whatwg/streams#1323)

@MattiasBuelens I wonder if I'm missing something here...

In a `ReadableStream` we can handle backpressure by limiting the amount of data we enqueue in `pull()` according to `controller.desiredSize`.

But it seems like in a `TransformStream` we can't really put `controller.desiredSize` to good use.  Our `transform()` could limit the amount of data it enqueues, but any of the remaining data from the input chunk would just be lost.

So can we make any reasonable decisions with `TransformStreamDefaultController.desiredSize`?

Theoretically, there should be a clean way to implement a `TransformStream` where given an input chunk `{ n: 483 }`, it enqueues 483 output chunks, respecting backpressure.  But it seems impossible to do something like that within the API's current limitations. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1323#issuecomment-2723092784
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1323/2723092784@github.com>

Received on Friday, 14 March 2025 01:22:31 UTC