仅使用可读流是否可以实现背压行为

Can backpressure behavior be achieved with only a readable stream

我是 javascript 中的 ReadableStream API 的新手,到目前为止,唯一演示背压的示例使用了 WriteableStream 对象,但我想知道是否可以仅使用可读流

经过进一步阅读,我找到了答案 - 是的。

To use backpressure in a ReadableStream, we can ask the controller for the chunk size desired by the consumer by querying the ReadableStreamDefaultController.desiredSize attribute on the controller. If it is too low, our ReadableStream can tell its underlying source to stop sending data, and we backpressure along the stream chain.

https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Concepts