mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
refactor(cli/rt): inline single line single use open helper functions (#7046)
This commit is contained in:
parent
a17ea9150d
commit
238816d62f
1 changed files with 9 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue