summaryrefslogtreecommitdiff
path: root/runtime/js/30_fs.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/30_fs.js')
-rw-r--r--runtime/js/30_fs.js55
1 files changed, 28 insertions, 27 deletions
diff --git a/runtime/js/30_fs.js b/runtime/js/30_fs.js
index 51f2c411e..2457713e6 100644
--- a/runtime/js/30_fs.js
+++ b/runtime/js/30_fs.js
@@ -3,6 +3,7 @@
((window) => {
const core = window.Deno.core;
+ const ops = core.ops;
const {
Date,
DatePrototype,
@@ -15,7 +16,7 @@
const build = window.__bootstrap.build.build;
function chmodSync(path, mode) {
- core.opSync("op_chmod_sync", { path: pathFromURL(path), mode });
+ ops.op_chmod_sync({ path: pathFromURL(path), mode });
}
async function chmod(path, mode) {
@@ -27,7 +28,7 @@
uid,
gid,
) {
- core.opSync("op_chown_sync", { path: pathFromURL(path), uid, gid });
+ ops.op_chown_sync({ path: pathFromURL(path), uid, gid });
}
async function chown(
@@ -45,7 +46,7 @@
fromPath,
toPath,
) {
- core.opSync("op_copy_file_sync", {
+ ops.op_copy_file_sync({
from: pathFromURL(fromPath),
to: pathFromURL(toPath),
});
@@ -62,15 +63,15 @@
}
function cwd() {
- return core.opSync("op_cwd");
+ return ops.op_cwd();
}
function chdir(directory) {
- core.opSync("op_chdir", pathFromURL(directory));
+ ops.op_chdir(pathFromURL(directory));
}
function makeTempDirSync(options = {}) {
- return core.opSync("op_make_temp_dir_sync", options);
+ return ops.op_make_temp_dir_sync(options);
}
function makeTempDir(options = {}) {
@@ -78,7 +79,7 @@
}
function makeTempFileSync(options = {}) {
- return core.opSync("op_make_temp_file_sync", options);
+ return ops.op_make_temp_file_sync(options);
}
function makeTempFile(options = {}) {
@@ -99,7 +100,7 @@
}
function mkdirSync(path, options) {
- core.opSync("op_mkdir_sync", mkdirArgs(path, options));
+ ops.op_mkdir_sync(mkdirArgs(path, options));
}
async function mkdir(
@@ -110,7 +111,7 @@
}
function readDirSync(path) {
- return core.opSync("op_read_dir_sync", pathFromURL(path))[
+ return ops.op_read_dir_sync(pathFromURL(path))[
SymbolIterator
]();
}
@@ -128,7 +129,7 @@
}
function readLinkSync(path) {
- return core.opSync("op_read_link_sync", pathFromURL(path));
+ return ops.op_read_link_sync(pathFromURL(path));
}
function readLink(path) {
@@ -136,7 +137,7 @@
}
function realPathSync(path) {
- return core.opSync("op_realpath_sync", pathFromURL(path));
+ return ops.op_realpath_sync(pathFromURL(path));
}
function realPath(path) {
@@ -147,7 +148,7 @@
path,
options = {},
) {
- core.opSync("op_remove_sync", {
+ ops.op_remove_sync({
path: pathFromURL(path),
recursive: !!options.recursive,
});
@@ -164,7 +165,7 @@
}
function renameSync(oldpath, newpath) {
- core.opSync("op_rename_sync", {
+ ops.op_rename_sync({
oldpath: pathFromURL(oldpath),
newpath: pathFromURL(newpath),
});
@@ -203,7 +204,7 @@
}
function fstatSync(rid) {
- return parseFileInfo(core.opSync("op_fstat_sync", rid));
+ return parseFileInfo(ops.op_fstat_sync(rid));
}
async function fstat(rid) {
@@ -219,7 +220,7 @@
}
function lstatSync(path) {
- const res = core.opSync("op_stat_sync", {
+ const res = ops.op_stat_sync({
path: pathFromURL(path),
lstat: true,
});
@@ -235,7 +236,7 @@
}
function statSync(path) {
- const res = core.opSync("op_stat_sync", {
+ const res = ops.op_stat_sync({
path: pathFromURL(path),
lstat: false,
});
@@ -251,7 +252,7 @@
}
function ftruncateSync(rid, len) {
- core.opSync("op_ftruncate_sync", { rid, len: coerceLen(len) });
+ ops.op_ftruncate_sync({ rid, len: coerceLen(len) });
}
async function ftruncate(rid, len) {
@@ -259,7 +260,7 @@
}
function truncateSync(path, len) {
- core.opSync("op_truncate_sync", { path, len: coerceLen(len) });
+ ops.op_truncate_sync({ path, len: coerceLen(len) });
}
async function truncate(path, len) {
@@ -267,11 +268,11 @@
}
function umask(mask) {
- return core.opSync("op_umask", mask);
+ return ops.op_umask(mask);
}
function linkSync(oldpath, newpath) {
- core.opSync("op_link_sync", { oldpath, newpath });
+ ops.op_link_sync({ oldpath, newpath });
}
async function link(oldpath, newpath) {
@@ -304,7 +305,7 @@
atime,
mtime,
) {
- core.opSync("op_futime_sync", {
+ ops.op_futime_sync({
rid,
atime: toUnixTimeFromEpoch(atime),
mtime: toUnixTimeFromEpoch(mtime),
@@ -328,7 +329,7 @@
atime,
mtime,
) {
- core.opSync("op_utime_sync", {
+ ops.op_utime_sync({
path: pathFromURL(path),
atime: toUnixTimeFromEpoch(atime),
mtime: toUnixTimeFromEpoch(mtime),
@@ -352,7 +353,7 @@
newpath,
options,
) {
- core.opSync("op_symlink_sync", {
+ ops.op_symlink_sync({
oldpath: pathFromURL(oldpath),
newpath: pathFromURL(newpath),
options,
@@ -372,7 +373,7 @@
}
function fdatasyncSync(rid) {
- core.opSync("op_fdatasync_sync", rid);
+ ops.op_fdatasync_sync(rid);
}
async function fdatasync(rid) {
@@ -380,7 +381,7 @@
}
function fsyncSync(rid) {
- core.opSync("op_fsync_sync", rid);
+ ops.op_fsync_sync(rid);
}
async function fsync(rid) {
@@ -388,7 +389,7 @@
}
function flockSync(rid, exclusive) {
- core.opSync("op_flock_sync", rid, exclusive === true);
+ ops.op_flock_sync(rid, exclusive === true);
}
async function flock(rid, exclusive) {
@@ -396,7 +397,7 @@
}
function funlockSync(rid) {
- core.opSync("op_funlock_sync", rid);
+ ops.op_funlock_sync(rid);
}
async function funlock(rid) {