How to go from Blob to ArrayBuffer

前端 未结 6 1043
旧时难觅i
旧时难觅i 2020-11-27 10:20

I was studying Blobs, and I noticed that when you have an ArrayBuffer, you can easily convert this to a Blob as follows:

var dataView = new DataView(arrayBuf         


        
6条回答
  •  甜味超标
    2020-11-27 10:56

    Or you can use the fetch API

    fetch(URL.createObjectURL(myBlob)).then(res => res.arrayBuffer())
    

    I don't know what the performance difference is, and this will show up on your network tab in DevTools as well.

提交回复
热议问题