diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-07-04 00:17:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 00:17:52 +0200 |
commit | 5addba2abc2e384e751e8884b4ac3219688c2473 (patch) | |
tree | a5249a82092909f32a852a910e5e144ddeffa497 /runtime/js/40_write_file.js | |
parent | ffa75be48044255ed49a822a7a61a2a130123a4a (diff) |
refactor: use primordials in runtime/, part2 (#11248)
Diffstat (limited to 'runtime/js/40_write_file.js')
-rw-r--r-- | runtime/js/40_write_file.js | 7 |
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(); |