Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix existing problems #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix existing problems #80

wants to merge 3 commits into from

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

Blob.js Show resolved Hide resolved
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