Skip to content

Clarify that the buffer is transferred by ReadableStreamBYOBReader.read() #39034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kaiido opened this issue Apr 8, 2025 · 2 comments
Closed
Labels
closed: question A user misinterpretation or support question. No action required. Content:WebAPI Web API docs

Comments

@Kaiido
Copy link
Contributor

Kaiido commented Apr 8, 2025

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read

What specific section or headline is this issue about?

Not entirely sure, maybe the top section

What information was incorrect, unhelpful, or incomplete?

There is no mention that the passed ArrayBuffer will be transferred.

What did you expect to see?

The page should probably clarify that the ArrayBuffer passed along the view will get transferred by the call to read(), making it unavailable until the actual read operation returns, where it can be gotten back from value.buffer as is being done in the example section.

I must admit I'm not sure how it should be presented though, hence this issue rather than a PR.

Do you have any supporting links, references, or citations?

If you follow the path from https://streams.spec.whatwg.org/#byob-reader-read, you end up at https://streams.spec.whatwg.org/#readable-byte-stream-controller-pull-into where step 10 will transfer the ArrayBuffer.

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@Kaiido Kaiido added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Apr 8, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Apr 8, 2025
@Josh-Cena
Copy link
Member

Josh-Cena commented Apr 8, 2025

This is already mentioned in the return value:

The original view will be detached and no longer usable.

Also in the introduction:

Note that once the promise fulfills, the original view passed to the method will be detached and no longer usable.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
@Josh-Cena Josh-Cena added closed: question A user misinterpretation or support question. No action required. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Apr 8, 2025
@Kaiido
Copy link
Contributor Author

Kaiido commented Apr 8, 2025

Wow, not sure how I could miss the paragraph in the description, which is exactly what I wanted to see. Somehow I searched for "transfer" instead of "detached".

Sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question A user misinterpretation or support question. No action required. Content:WebAPI Web API docs
Projects
None yet
Development

No branches or pull requests

2 participants