diff options
Diffstat (limited to 'cli/js/ops/fs/chmod.ts')
-rw-r--r-- | cli/js/ops/fs/chmod.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/js/ops/fs/chmod.ts b/cli/js/ops/fs/chmod.ts new file mode 100644 index 000000000..9e748672f --- /dev/null +++ b/cli/js/ops/fs/chmod.ts @@ -0,0 +1,22 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +import { sendSync, sendAsync } from "../dispatch_json.ts"; + +/** Synchronously changes the permission of a specific file/directory of + * specified path. Ignores the process's umask. + * + * Deno.chmodSync("/path/to/file", 0o666); + * + * Requires `allow-write` permission. */ +export function chmodSync(path: string, mode: number): void { + sendSync("op_chmod", { path, mode }); +} + +/** Changes the permission of a specific file/directory of specified path. + * Ignores the process's umask. + * + * await Deno.chmod("/path/to/file", 0o666); + * + * Requires `allow-write` permission. */ +export async function chmod(path: string, mode: number): Promise<void> { + await sendAsync("op_chmod", { path, mode }); +} |