Skip to content

Fix existing problems - #80

Open
zyrong wants to merge 3 commits into
eligrey:masterfrom
zyrong:master
Open

Fix existing problems#80
zyrong wants to merge 3 commits into
eligrey:masterfrom
zyrong:master

Conversation

@zyrong

@zyrong zyrong commented Apr 3, 2022

Copy link
Copy Markdown
  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

Comment thread Blob.js
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