awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
7.73k stars 341 forks source link

feat: Improved compliance of Blob and Body #413

Closed nabetti1720 closed 2 weeks ago

nabetti1720 commented 2 weeks ago

Description of changes

Add the following methods to improve the compliance of Blob and Body Object.

Checklist

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

richarddavison commented 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()

nabetti1720 commented 2 weeks ago

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. :)