fs.cp(src, dest[, options], callback)
稳定性: 1 - 实验性
src<string> | <URL> 要复制的源路径。dest<string> | <URL> 复制到的目标路径。options<Object>dereference<boolean> 取消符号链接引用。默认值:false。errorOnExist<boolean> 当force为false且目标已存在时,抛出错误。默认值:false。filter<Function> 用于筛选复制的文件/目录的函数。返回true表示复制该项,返回false表示忽略。当忽略一个目录时,其所有内容也将被跳过。也可以返回一个解析为true或false的Promise。默认值:undefined。force<boolean> 覆盖现有的文件或目录。如果将其设置为 false 并且目标已存在,复制操作将忽略错误。使用errorOnExist选项可以改变此行为。默认值:true.mode<integer> 用于复制操作的修饰符。默认值:0。详见fs.copyFile()的mode标志。preserveTimestamps<boolean> 当设置为true时,将保留来自src的时间戳。默认值:false。recursive<boolean> 递归复制目录 默认值:falseverbatimSymlinks<boolean> 当设置为true时,将跳过符号链接的路径解析。默认值:false
callback<Function>err<Error>
异步地将整个目录结构从 src 复制到 dest,包括子目录和文件。
【Asynchronously copies the entire directory structure from src to dest,
including subdirectories and files.】
将目录复制到另一个目录时,不支持通配符,行为类似于 cp dir1/ dir2/。
【When copying a directory to another directory, globs are not supported and
behavior is similar to cp dir1/ dir2/.】