Skip to content

Conversation

@zyrong
Copy link

@zyrong zyrong commented Apr 3, 2022

  1. fix: new Blob(chunks); chunks exists references modify problem
require('./Blob')

const arr =  ['str']
new Blob(arr)
console.log(arr);
// The original array has been modified,Final output [ Uint8Array(3) [ 115, 116, 114 ] ]
// Expected results: ['str']
  1. fix: ArrayBuffer.isView judge DataView Existing problems
const dataView = new DataView(new Uint8Array([1,2,3]).buffer)
const blob = new Blob([dataView])
blob.arrayBuffer().then(buffer => {
  console.log(buffer);
  // Final output: [ 0, 0, 0 ]
  // Expected results: [ 1, 2, 3 ]
})

use the ArrayBuffer.isView method to check that the DataView is true.
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants