最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Read all bytes from a ReadableStream - Stack Overflow

programmeradmin1浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 9

Fetch's Response interface has .arrayBuffer() which returns an ArrayBuffer.

发布评论

评论列表(0)

  1. 暂无评论