summaryrefslogtreecommitdiff
path: root/runtime/js/12_io.js
diff options
context:
space:
mode:
authorInteon <42113979+inteon@users.noreply.github.com>2021-03-20 17:51:08 +0100
committerGitHub <noreply@github.com>2021-03-20 17:51:08 +0100
commit1251c893212d57303ecdfa8d953d1e487cb7ec7d (patch)
tree80b3a55872db0a4ee0c9e594601d330e39ca4873 /runtime/js/12_io.js
parent0d26a82ea9169c013e9b0f29c1ec418b28e273cf (diff)
refactor: Move bin ops to deno_core and unify logic with json ops (#9457)
This commit moves implementation of bin ops to "deno_core" crates as well as unifying logic between bin ops and json ops to reuse as much code as possible (both in Rust and JavaScript).
Diffstat (limited to 'runtime/js/12_io.js')
-rw-r--r--runtime/js/12_io.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/js/12_io.js b/runtime/js/12_io.js
index 09e87f990..fe815c7ed 100644
--- a/runtime/js/12_io.js
+++ b/runtime/js/12_io.js
@@ -6,8 +6,8 @@
"use strict";
((window) => {
+ const core = window.Deno.core;
const DEFAULT_BUFFER_SIZE = 32 * 1024;
- const { bufferOpSync, bufferOpAsync } = window.__bootstrap.dispatchBuffer;
// Seek whence values.
// https://golang.org/pkg/io/#pkg-constants
const SeekMode = {
@@ -81,7 +81,7 @@
return 0;
}
- const nread = bufferOpSync("op_read_sync", rid, buffer);
+ const nread = core.binOpSync("op_read_sync", rid, buffer);
if (nread < 0) {
throw new Error("read error");
}
@@ -97,7 +97,7 @@
return 0;
}
- const nread = await bufferOpAsync("op_read_async", rid, buffer);
+ const nread = await core.binOpAsync("op_read_async", rid, buffer);
if (nread < 0) {
throw new Error("read error");
}
@@ -106,7 +106,7 @@
}
function writeSync(rid, data) {
- const result = bufferOpSync("op_write_sync", rid, data);
+ const result = core.binOpSync("op_write_sync", rid, data);
if (result < 0) {
throw new Error("write error");
}
@@ -115,7 +115,7 @@
}
async function write(rid, data) {
- const result = await bufferOpAsync("op_write_async", rid, data);
+ const result = await core.binOpAsync("op_write_async", rid, data);
if (result < 0) {
throw new Error("write error");
}