-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support decoding ArrayBuffers (#287)
When using `fetch` to download something over HTTP, it only makes an `ArrayBuffer` available, not a `Uint8Array`. `TextDecoder` supports decoding `ArrayBuffer`s, and the `raw` codec turns passed `ArrayBuffer`s into `Uint8Array`s so this is just a type change. Instead of: ```js const res = await fetch('...') const obj = json.decode(new Uint8Array(await res.arrayBuffer())) ``` we can do: ```js const res = await fetch('...') const obj = json.decode(await res.arrayBuffer()) ```
- Loading branch information
1 parent
aa9c730
commit e7f3272
Showing
5 changed files
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters