diff options
Diffstat (limited to 'client-web/source/download_stream.ts')
-rw-r--r-- | client-web/source/download_stream.ts | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/client-web/source/download_stream.ts b/client-web/source/download_stream.ts index d2cf1c5..6ea7f70 100644 --- a/client-web/source/download_stream.ts +++ b/client-web/source/download_stream.ts @@ -19,16 +19,12 @@ function FallbackStreamDownload(size: number, filename?: string, progress?: (pos a.click() }, abort() { buffer = new Uint8Array(); /* have fun gc */ }, - write(chunk: Blob) { - const reader = new FileReader(); - reader.onload = function (event) { - const arr = new Uint8Array(event.target!.result as ArrayBuffer); - for (let i = 0; i < arr.length; i++, position++) { - buffer[position] = arr[i] - } - if (progress) progress(position) - }; - reader.readAsArrayBuffer(chunk); + write(chunk: ArrayBuffer) { + const arr = new Uint8Array(chunk as ArrayBuffer); + for (let i = 0; i < arr.length; i++, position++) { + buffer[position] = arr[i] + } + if (progress) progress(position) } } } |