From b8d819c3a7e4c68152c4354b10aab6bdf5ead67c Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 17 Jul 2025 21:21:52 +0200 Subject: [PATCH] [WasmFS] Simplify read/write in the Node backend. NFC In line with commit c77be74cb68d8aa08b8139a440483afa280278ae. --- src/lib/libwasmfs_node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libwasmfs_node.js b/src/lib/libwasmfs_node.js index 586eb3c77722f..6735281205bb9 100644 --- a/src/lib/libwasmfs_node.js +++ b/src/lib/libwasmfs_node.js @@ -206,7 +206,7 @@ addToLibrary({ return wasmfsTry(() => { // TODO: Cache open file descriptors to guarantee that opened files will // still exist when we try to access them. - let nread = fs.readSync(fd, new Int8Array(HEAPU8.buffer, buf_p, len), 0, len, pos); + let nread = fs.readSync(fd, HEAPU8, buf_p, len, pos); {{{ makeSetValue('nread_p', 0, 'nread', 'i32') }}}; // implicitly return 0 }); @@ -217,7 +217,7 @@ addToLibrary({ return wasmfsTry(() => { // TODO: Cache open file descriptors to guarantee that opened files will // still exist when we try to access them. - let nwritten = fs.writeSync(fd, new Int8Array(HEAPU8.buffer, buf_p, len), 0, len, pos); + let nwritten = fs.writeSync(fd, HEAPU8, buf_p, len, pos); {{{ makeSetValue('nwritten_p', 0, 'nwritten', 'i32') }}}; // implicitly return 0 });