mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-02-10 19:22:40 +00:00
feat: change update chunking
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user