diff options
author | dubiousjim <dubiousjim@gmail.com> | 2020-03-16 15:02:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 15:02:41 -0400 |
commit | f9557a4ff6b73a4af37e713bb6b2294253c7b230 (patch) | |
tree | 0a4e05e6fb709e1c4ebb4bc21c2b50685049e6f4 /cli/js/files.ts | |
parent | 8077ade7413db72572b8685c883f078335e0561b (diff) |
Add mode option to open/create (#4289)
Diffstat (limited to 'cli/js/files.ts')
-rw-r--r-- | cli/js/files.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cli/js/files.ts b/cli/js/files.ts index b9da1363f..99ae19879 100644 --- a/cli/js/files.ts +++ b/cli/js/files.ts @@ -22,43 +22,47 @@ import { } from "./ops/fs/open.ts"; export { OpenOptions, OpenMode } from "./ops/fs/open.ts"; -export function openSync(path: string, mode?: OpenOptions): File; -export function openSync(path: string, mode?: OpenMode): File; +export function openSync(path: string, options?: OpenOptions): File; +export function openSync(path: string, openMode?: OpenMode): File; + +/**@internal*/ export function openSync( path: string, modeOrOptions: OpenOptions | OpenMode = "r" ): File { - let mode = undefined; + let openMode = undefined; let options = undefined; if (typeof modeOrOptions === "string") { - mode = modeOrOptions; + openMode = modeOrOptions; } else { checkOpenOptions(modeOrOptions); options = modeOrOptions as OpenOptions; } - const rid = opOpenSync(path, mode as OpenMode, options); + const rid = opOpenSync(path, openMode as OpenMode, options); return new File(rid); } export async function open(path: string, options?: OpenOptions): Promise<File>; -export async function open(path: string, mode?: OpenMode): Promise<File>; +export async function open(path: string, openMode?: OpenMode): Promise<File>; + +/**@internal*/ export async function open( path: string, modeOrOptions: OpenOptions | OpenMode = "r" ): Promise<File> { - let mode = undefined; + let openMode = undefined; let options = undefined; if (typeof modeOrOptions === "string") { - mode = modeOrOptions; + openMode = modeOrOptions; } else { checkOpenOptions(modeOrOptions); options = modeOrOptions as OpenOptions; } - const rid = await opOpen(path, mode as OpenMode, options); + const rid = await opOpen(path, openMode as OpenMode, options); return new File(rid); } |