update 2026-07-24 18:11:38

This commit is contained in:
action
2026-07-24 18:11:38 +08:00
parent 2cae7975b1
commit 75e8d52691
25 changed files with 131 additions and 259 deletions
@@ -103,8 +103,11 @@ return baseclass.extend({
let promise = Promise.resolve();
for(let offset = 0; offset < bytes.length; offset += chunkSize) {
const chunkBytes = bytes.slice(offset, Math.min(offset + chunkSize, bytes.length));
const chunk = decoder.decode(chunkBytes);
const chunkStart = offset;
const chunkEnd = Math.min(offset + chunkSize, bytes.length);
const isLastChunk = chunkEnd === bytes.length;
const chunkBytes = bytes.slice(chunkStart, chunkEnd);
const chunk = decoder.decode(chunkBytes, { stream: !isLastChunk });
const append = offset > 0;
promise = promise.then(() => callFileWrite(path, chunk, append, mode));
}