diff options
-rw-r--r-- | cli/rt/30_files.js | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/cli/rt/30_files.js b/cli/rt/30_files.js index 0b6d9c67f..9ff2fe368 100644 --- a/cli/rt/30_files.js +++ b/cli/rt/30_files.js @@ -22,25 +22,14 @@ return sendAsync("op_seek", { rid, offset, whence }); } - function opOpenSync(path, options) { - const mode = options?.mode; - return sendSync("op_open", { path: pathFromURL(path), options, mode }); - } - - function opOpen( - path, - options, - ) { - const mode = options?.mode; - return sendAsync("op_open", { path: pathFromURL(path), options, mode }); - } - function openSync( path, options = { read: true }, ) { checkOpenOptions(options); - const rid = opOpenSync(path, options); + const mode = options?.mode; + const rid = sendSync("op_open", { path: pathFromURL(path), options, mode }); + return new File(rid); } @@ -49,7 +38,12 @@ options = { read: true }, ) { checkOpenOptions(options); - const rid = await opOpen(path, options); + const mode = options?.mode; + const rid = await sendAsync( + "op_open", + { path: pathFromURL(path), options, mode }, + ); + return new File(rid); } |