Closed nabetti1720 closed 2 weeks ago
Thanks for the PR, awesome work
Im very surprised these APIs still don't work in browsers yet:
await new Blob(["text"]).bytes()
Hi, @richarddavison.
Yes, Since it was recently incorporated into the File API, I believe it will be supported in the future. https://github.com/w3c/FileAPI/pull/198
In addition, other Javascript runtimes seem to be progressing in their support.
Bun
already supports it.
% bun -e "console.log(await new Blob(['text']).bytes());"
Uint8Array(4) [ 116, 101, 120, 116 ]
Deno
seems to be trying to support exactly that.
https://github.com/denoland/deno/pull/24148
I would like to help improve compliance with WinterCG and other standards as much as I can. :)
Description of changes
Add the following methods to improve the compliance of
Blob
andBody
Object.Blob.bytes() https://www.w3.org/TR/FileAPI/#bytes-method-algo
Body.bytes() https://fetch.spec.whatwg.org/#dom-body-bytes
Checklist
tests/unit
and/or in Rust for my feature if neededmake fix
to format JS and apply Clippy auto fixesmake check
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.