Failed to construct 'Blob': Array length exceeds supported limit

后端 未结 1 1162
轻奢々
轻奢々 2020-12-21 11:16

I try to construct a simple 10.5mb Blob using the following (Chrome browser):

var arr = new Uint8Array(10485833);
var blob = new Blob(arr, { type: \'applicat         


        
相关标签:
1条回答
  • 2020-12-21 11:50

    This is because Blob expects an array of chunks. The array you are passing is way too big for it. (Probably related)

    The solution is simply to wrap this array in a single lenghted array.

    var arr = new Uint8Array(10485833);
    console.log(new Blob([ arr ], {type:'application/octet-stream'}))
    //                   ^_____^_____ wrapped in a single lengthed Array

    0 讨论(0)
提交回复
热议问题