Skip to content

Commit 7585d8f

Browse files
committed
Use blob slice when reading.
1 parent 8eab1ee commit 7585d8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/library_wasmfs_opfs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ mergeInto(LibraryManager.library, {
3030
}
3131
async read(buffer, options = { at: 0 }) {
3232
let file = await this.handle.getFile();
33-
let fileBuffer = await file.arrayBuffer();
34-
let array = new Uint8Array(fileBuffer, options.at);
33+
let slice = await file.slice(options.at);
34+
let fileBuffer = await slice.arrayBuffer();
35+
let array = new Uint8Array(fileBuffer);
3536
buffer.set(array);
3637
return array.length;
3738
}

0 commit comments

Comments
 (0)