From cda2a527d99db1e8702b42f9f1198bfe7c626878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Fri, 30 Jan 2026 17:26:31 +0100 Subject: [PATCH] feat: change update chunking --- src/lib/serial/device.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/serial/device.ts b/src/lib/serial/device.ts index 1983dc71..e8e94e6b 100644 --- a/src/lib/serial/device.ts +++ b/src/lib/serial/device.ts @@ -583,12 +583,17 @@ export class CharaDevice { return it; }); - const chunkSize = 128; + const chunkSize = 1024; + const promises = []; for (let i = 0; i < file.byteLength; i += chunkSize) { const chunk = file.slice(i, i + chunkSize); - await writer.write(new Uint8Array(chunk)); - progress(i + chunk.byteLength, file.byteLength); + promises.push( + writer + .write(new Uint8Array(chunk)) + .then(() => progress(i + chunk.byteLength, file.byteLength)), + ); } + await Promise.all(promises); serialLog.update((it) => { it.push({