summaryrefslogtreecommitdiff
path: root/runtime/js/40_write_file.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/40_write_file.js')
-rw-r--r--runtime/js/40_write_file.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/js/40_write_file.js b/runtime/js/40_write_file.js
index 4662849a5..def9f6fee 100644
--- a/runtime/js/40_write_file.js
+++ b/runtime/js/40_write_file.js
@@ -4,6 +4,9 @@
const { stat, statSync, chmod, chmodSync } = window.__bootstrap.fs;
const { open, openSync } = window.__bootstrap.files;
const { build } = window.__bootstrap.build;
+ const {
+ TypedArrayPrototypeSubarray,
+ } = window.__bootstrap.primordials;
function writeFileSync(
path,
@@ -33,7 +36,7 @@
let nwritten = 0;
while (nwritten < data.length) {
- nwritten += file.writeSync(data.subarray(nwritten));
+ nwritten += file.writeSync(TypedArrayPrototypeSubarray(data, nwritten));
}
file.close();
@@ -67,7 +70,7 @@
let nwritten = 0;
while (nwritten < data.length) {
- nwritten += await file.write(data.subarray(nwritten));
+ nwritten += await file.write(TypedArrayPrototypeSubarray(data, nwritten));
}
file.close();