Skip to content
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 bytes() method to Blob for reading bytes into a Uint8Array #197

Closed
wants to merge 2 commits into from

Conversation

bakkot
Copy link

@bakkot bakkot commented May 10, 2024

Edit: Replaced by #198.


The Fetch API is getting a Uint8Array-returning bytes() method alongside its existing arrayBuffer() method, following the principle that APIs should generally vend byte buffers as Uint8Arrays.

This PR makes the same change for Blob, which has its own distinct arrayBuffer method.

I'm assuming this is uncontroversial given the support from the three major implementations for doing this on Body, but I can open an issue and solicit explicit support separately if you'd prefer. I'll write tests if I get a signal that this is able to go forward. Tests written, see link.

Implementation commitment:


Preview | Diff

Copy link
Collaborator

@mkruisselbrink mkruisselbrink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me; it certainly was the intention of Blob to mimic Body as much as possible.

index.bs Outdated Show resolved Hide resolved
@mkruisselbrink
Copy link
Collaborator

And while getting support signals from implementers is probably not needed for this PR, filing implementation bugs would still be a good thing. (also the IPR bot seems to not know who you are/if you've joined the webapps working group).

@bakkot
Copy link
Author

bakkot commented May 13, 2024

I'll file implementation requests.

Joining W3C working groups is something of a pain, especially just for trivial changes like this. Is there a way to... not do that? If not I am happy to close this and let someone else to make exactly the same change in their own PR. I'll still file the implementation requests.

@bakkot
Copy link
Author

bakkot commented May 13, 2024

Filed the implementation issues, linked in the OP. I didn't check the boxes because they're not technically implementation commitments at the moment.

@marcoscaceres
Copy link
Member

marcoscaceres commented May 20, 2024

Pinged the @siusin for help with getting the IPR commitment on this. Will get it sorted ASAP.

@marcoscaceres
Copy link
Member

(worst case, I'll copy/pasta the PR... the change is substantive so we need the commitments)

@marcoscaceres
Copy link
Member

wow! great minds think alike 😜:
#198

@bakkot
Copy link
Author

bakkot commented May 21, 2024

Thanks!

@bakkot bakkot closed this May 21, 2024
@bakkot bakkot deleted the bytes-method branch May 21, 2024 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants