Change requestEntireFile() slice offset logic (#390)

This commit is contained in:
Vanilagy
2026-06-02 13:28:37 +02:00
parent 6832153fef
commit d92df801bf
+5 -4
View File
@@ -120,15 +120,16 @@ export class Reader {
return this.requestSlice(0, this.fileSizeNonStrict); return this.requestSlice(0, this.fileSizeNonStrict);
} }
const startOffset = chunks.length * CHUNK_SIZE; let slice = this.requestSliceRange(currentSize, 0, CHUNK_SIZE);
let slice = this.requestSliceRange(startOffset, 0, CHUNK_SIZE);
if (slice instanceof Promise) slice = await slice; if (slice instanceof Promise) slice = await slice;
if (!slice) { if (!slice || slice.length === 0) {
break; break;
} }
chunks.push(readBytes(slice, slice.length)); const chunk = readBytes(slice, slice.length);
chunks.push(chunk);
currentSize += slice.length; currentSize += slice.length;
} }