mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-02-15 13:42:42 +00:00
feat: change update chunking
This commit is contained in:
@@ -583,12 +583,17 @@ export class CharaDevice {
|
|||||||
return it;
|
return it;
|
||||||
});
|
});
|
||||||
|
|
||||||
const chunkSize = 128;
|
const chunkSize = 1024;
|
||||||
|
const promises = [];
|
||||||
for (let i = 0; i < file.byteLength; i += chunkSize) {
|
for (let i = 0; i < file.byteLength; i += chunkSize) {
|
||||||
const chunk = file.slice(i, i + chunkSize);
|
const chunk = file.slice(i, i + chunkSize);
|
||||||
await writer.write(new Uint8Array(chunk));
|
promises.push(
|
||||||
progress(i + chunk.byteLength, file.byteLength);
|
writer
|
||||||
|
.write(new Uint8Array(chunk))
|
||||||
|
.then(() => progress(i + chunk.byteLength, file.byteLength)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
|
|
||||||
serialLog.update((it) => {
|
serialLog.update((it) => {
|
||||||
it.push({
|
it.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user