summaryrefslogtreecommitdiff
path: root/client-web/source/download_stream.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-05-27 13:47:56 +0200
committermetamuffin <metamuffin@disroot.org>2023-05-27 13:47:56 +0200
commitab1c3b39a1077b3f4bad75c6a0722c850d06d409 (patch)
treebddfff3e47c8f5559c60d0346492f1917c9b9f25 /client-web/source/download_stream.ts
parentadb6d2425997841b51d9989e0a5a268810742e71 (diff)
downloadkeks-meet-ab1c3b39a1077b3f4bad75c6a0722c850d06d409.tar
keks-meet-ab1c3b39a1077b3f4bad75c6a0722c850d06d409.tar.bz2
keks-meet-ab1c3b39a1077b3f4bad75c6a0722c850d06d409.tar.zst
handle dc on_message ArrayBuffer as well to work in chromium
Diffstat (limited to 'client-web/source/download_stream.ts')
-rw-r--r--client-web/source/download_stream.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/client-web/source/download_stream.ts b/client-web/source/download_stream.ts
index 5aafde1..3de8e70 100644
--- a/client-web/source/download_stream.ts
+++ b/client-web/source/download_stream.ts
@@ -71,15 +71,11 @@ export function StreamDownload({ size, filename, cancel, progress }: {
abort() {
port1.postMessage("abort")
},
- write(chunk: Blob) {
- const reader = new FileReader();
- reader.onload = function (event) {
- const arr = new Uint8Array(event.target!.result as ArrayBuffer);
- port1.postMessage(arr)
- position += arr.length
- if (progress) progress(position)
- };
- reader.readAsArrayBuffer(chunk);
+ write(chunk: ArrayBuffer) {
+ const arr = new Uint8Array(chunk);
+ port1.postMessage(arr)
+ position += arr.length
+ if (progress) progress(position)
}
}
}