diff options
Diffstat (limited to 'cli/js/remove.ts')
-rw-r--r-- | cli/js/remove.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/cli/js/remove.ts b/cli/js/remove.ts index 53ceb825b..4d15cf241 100644 --- a/cli/js/remove.ts +++ b/cli/js/remove.ts @@ -2,27 +2,29 @@ import { sendSync, sendAsync } from "./dispatch_json.ts"; export interface RemoveOption { + /** Defaults to `false`. If set to `true`, path will be removed even if + * it's a non-empty directory. */ recursive?: boolean; } -/** Removes the named file, directory or symlink synchronously. Would throw - * error if permission denied, not found, or directory not empty if `recursive` - * set to false. - * `recursive` is set to false by default. +/** Synchronously removes the named file or directory. Throws error if + * permission denied, path not found, or path is a non-empty directory and + * the `recursive` option isn't set to `true`. * - * Deno.removeSync("/path/to/dir/or/file", {recursive: false}); - */ + * Deno.removeSync("/path/to/dir/or/file", { recursive: false }); + * + * Requires `allow-write` permission. */ export function removeSync(path: string, options: RemoveOption = {}): void { sendSync("op_remove", { path, recursive: !!options.recursive }); } -/** Removes the named file, directory or symlink. Would throw error if - * permission denied, not found, or directory not empty if `recursive` set - * to false. - * `recursive` is set to false by default. +/** Removes the named file or directory. Throws error if permission denied, + * path not found, or path is a non-empty directory and the `recursive` + * option isn't set to `true`. + * + * await Deno.remove("/path/to/dir/or/file", { recursive: false }); * - * await Deno.remove("/path/to/dir/or/file", {recursive: false}); - */ + * Requires `allow-write` permission. */ export async function remove( path: string, options: RemoveOption = {} |