- From: Kevin Gibbons <notifications@github.com>
- Date: Mon, 29 Jan 2024 15:42:48 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 29 January 2024 23:42:54 UTC
### What problem are you trying to solve? Body has an `.arrayBuffer()` method, but that's [almost never what you actually want](https://github.com/w3ctag/design-principles/issues/463), since you can't read out of a buffer directly - you need a view. Uint8Array is the canonical "sequence of byte values" view. ### What solutions exist today? `new Uint8Array(await body.arrayBuffer())` ### How would you solve it? Add a `.bytes()` method which gives a new `Uint8Array`. ### Anything else? Some brief discussion [here](https://matrixlogs.bakkot.com/WHATWG/2024-01-18#L1-L3). PushMessageData and Blob would need this too, since they just copied Body. (Also, watch out for https://github.com/whatwg/fetch/issues/1675 while specifying.) -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/1732 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/1732@github.com>
Received on Monday, 29 January 2024 23:42:54 UTC