Deno.copyfile
copyFile
-
copyFile(fromPath: string, toPath: string): Promise<void>
-
将一个文件的内容和权限复制到另一个指定的路径,默认情况下根据需要 创建新文件或者覆盖原文件。 如果目标路径是目录或不可写,则失败。
Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.
await Deno.copyFile("from.txt", "to.txt");
fromPath
需要allow-read
权限。toPath
需要allow-write
权限。Requires
allow-read
permission on fromPath. Requiresallow-write
permission on toPath.参数
-
fromPath: string
-
toPath: string
返回 Promise<void>
-