diff --git a/examples/browser-umd/.eslintrc.json b/examples/browser-umd/.eslintrc.json deleted file mode 100644 index bc9eef4..0000000 --- a/examples/browser-umd/.eslintrc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "env": { - "browser": true - }, - "globals": { - "MediaInfo": "readonly" - }, - "parserOptions": { - "sourceType": "script" - } -} diff --git a/examples/browser-umd/example.js b/examples/browser-umd/example.js index f9142a0..f90c569 100644 --- a/examples/browser-umd/example.js +++ b/examples/browser-umd/example.js @@ -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 })