Deno.remove
remove
-
remove(path: string, options?: RemoveOptions): Promise<void>
-
删除指定的文件或目录。
Removes the named file or directory.
await Deno.remove("/path/to/empty_dir/or/file"); await Deno.remove("/path/to/populated_dir/or/file", { recursive: true });
当权限被拒绝、路径找不到或者为非空目录且
recursive
未设置为true
,则抛出异常。Throws error if permission denied, path not found, or path is a non-empty directory and the
recursive
option isn’t set totrue
.需要
allow-write
权限。Requires
allow-write
permission.
参数
- ##### path: string
- ##### Optional options: [RemoveOptions](interfaces/deno.removeoptions.html)