-
Notifications
You must be signed in to change notification settings - Fork 323
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
add a method to get a Uint8Array to Body #1732
Labels
Comments
FWIW, WebKit is okay with adding this. cc @valenting @ricea |
Sounds good to me, but I'd like @saschanaz 's opinion as well. |
Sounds okay to me. |
Chromium supports. |
This was referenced May 4, 2024
This was referenced May 13, 2024
annevk
pushed a commit
that referenced
this issue
May 14, 2024
Returns a Uint8Array as opposed to requiring users to get an ArrayBuffer and wrap it. Tests: web-platform-tests/wpt#46198. Fixes #1732.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What problem are you trying to solve?
Body has an
.arrayBuffer()
method, but that's almost never what you actually want, since you can't read out of a buffer directly - you need a view. Uint8Array is the canonical "sequence of byte values" view.What solutions exist today?
new Uint8Array(await body.arrayBuffer())
How would you solve it?
Add a
.bytes()
method which gives a newUint8Array
.Anything else?
Some brief discussion here.
PushMessageData and Blob (which live elsewhere) would need this too, since they just copied Body.
(Also, watch out for #1675 while specifying.)
The text was updated successfully, but these errors were encountered: