I'd like to load an entire fetch response in one go, but there doesn't seem to be a readAll
or similar function.
What is the most performant way to read every byte from a ReadableStreamDefaultReader into a single Uint8Array?
I'd like to load an entire fetch response in one go, but there doesn't seem to be a readAll
or similar function.
What is the most performant way to read every byte from a ReadableStreamDefaultReader into a single Uint8Array?
Share Improve this question edited Apr 24, 2019 at 13:17 Marvin Irwin asked Apr 24, 2019 at 12:33 Marvin IrwinMarvin Irwin 1,0309 silver badges17 bronze badges 2-
1
would
response.arrayBuffer()
do what you need? – Daniel A. White Commented Apr 24, 2019 at 12:36 - Damn, I walked right by that one. Post that as the answer and I'll accept – Marvin Irwin Commented Apr 24, 2019 at 12:38
1 Answer
Reset to default 9Fetch's Response
interface has .arrayBuffer()
which returns an ArrayBuffer
.