Skip to content

Commit 15f1e1a

Browse files
committed
chore: update readme faq
1 parent 61efb07 commit 15f1e1a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,17 @@ Bun 1.1.5 added a similar feature in [April 2024](https://bun.sh/blog/bun-v1.1.5
9494
```js
9595
import html from "./index.html" with { type: "text" };
9696
```
97+
98+
### What about ArrayBuffer vs Uint8Array?
99+
100+
Both are viable solutions. Uint8Array matches the [Response.bytes()](https://developer.mozilla.org/en-US/docs/Web/API/Response/bytes) method return type as well as [Deno's implementation](https://deno.com/blog/v2.4#importing-text-and-bytes). Uint8Array is also compatible with [Node.js Buffer](https://nodejs.org/api/buffer.html#buffer) which makes it widely compatible with existing JavaScript code.
101+
102+
### What about Blob vs Uint8Array?
103+
104+
Blob is part of the W3C [File API](https://www.w3.org/TR/FileAPI/), not part of JavaScript so it is not a viable solution to include in a TC39 Proposal. Blob also includes a type and is immutable.
105+
106+
### What about mutable vs immutable?
107+
108+
Both are viable solutions. Mutable would match the behavior of existing imports from [roposal-import-attributes](https://github.com/tc39/proposal-import-attributes) but there is still a possibility of making `bytes` default to immutable given the [proposal-immutable-arraybuffer](https://github.com/tc39/proposal-immutable-arraybuffer).
109+
110+
Ideally there would be a separate proposal for a new `immutable` attribute.

0 commit comments

Comments
 (0)