Skip to content

Commit

Permalink
chore(examples): update browser UMD example
Browse files Browse the repository at this point in the history
  • Loading branch information
buzz committed May 30, 2024
1 parent e5e6e56 commit 0590928
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
11 changes: 0 additions & 11 deletions examples/browser-umd/.eslintrc.json

This file was deleted.

17 changes: 3 additions & 14 deletions examples/browser-umd/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@ const onChangeFile = (mediainfo) => {
if (file) {
output.value = 'Working…'

const getSize = () => file.size

const readChunk = (chunkSize, offset) =>
new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onload = (event) => {
if (event.target.error) {
reject(event.target.error)
}
resolve(new Uint8Array(event.target.result))
}
reader.readAsArrayBuffer(file.slice(offset, offset + chunkSize))
})
const readChunk = async (chunkSize, offset) =>
new Uint8Array(await file.slice(offset, offset + chunkSize).arrayBuffer())

mediainfo
.analyzeData(getSize, readChunk)
.analyzeData(file.size, readChunk)
.then((result) => {
output.value = result
})
Expand Down

0 comments on commit 0590928

Please sign in to comment.