Re: [whatwg/streams] Why does the `read` method of `ReadableStreamBYOBReader` class, need to _transfer_ the buffer it is provided? (Issue #1348)

MattiasBuelens left a comment (whatwg/streams#1348)

Yeah, I think once we allow SABs for readable byte streams, we'll have to make sure all browser APIs that create byte streams (like `fetch`) **must** also support SABs. We already have the following note for the [current BYOB request view](https://streams.spec.whatwg.org/#readablestream-current-byob-request-view) when used from other specifications:
> Specifications must not [transfer](https://webidl.spec.whatwg.org/#arraybuffer-transfer) or [detach](https://webidl.spec.whatwg.org/#dfn-detach) the [underlying buffer](https://webidl.spec.whatwg.org/#buffersource-underlying-buffer) of the [current BYOB request view](https://streams.spec.whatwg.org/#readablestream-current-byob-request-view).

So as long as all other specifications only use [our defined operations for creating streams](https://streams.spec.whatwg.org/#other-specs) (which they should) and don't violate that rule, I *think* we should be fine?

Then the only remaining concern is user-land readable byte streams (i.e. `new ReadableStream({ type: 'bytes' })` from JS) that don't support SAB. But then you can hopefully fix the underlying byte source implementation in your own JS code.

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

Message ID: <whatwg/streams/issues/1348/3191433706@github.com>

Received on Friday, 15 August 2025 12:53:07 UTC