From 2130fa3c1d705ce76d88cb49ee6baa4028267577 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 8 Sep 2023 16:39:47 +0200 Subject: fix fallbackdownloadstream type --- client-web/source/download_stream.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'client-web/source') 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) } } } -- cgit v1.2.3-70-g09d2