fsPromises.cp(src, dest[, options])

    将整个目录结构从 src 异步地复制到 dest,包括子目录和文件。

    Stability: 1 - Experimental

    • src <string> | <URL> source path to copy.
    • dest <string> | <URL> destination path to copy to.
    • options <Object>
      • dereference <boolean> dereference symlinks. Default: false.
      • errorOnExist <boolean> when force is false, and the destination exists, throw an error. Default: false.
      • filter <Function> Function to filter copied files/directories. Return true to copy the item, false to ignore it. Can also return a Promise that resolves to true or false Default: undefined.
      • force <boolean> overwrite existing file or directory. The copy operation will ignore errors if you set this to false and the destination exists. Use the errorOnExist option to change this behavior. Default: true.
      • preserveTimestamps <boolean> When true timestamps from src will be preserved. Default: false.
      • recursive <boolean> copy directories recursively Default: false
      • verbatimSymlinks <boolean> When true, path resolution for symlinks will be skipped. Default: false
    • Returns: <Promise> Fulfills with undefined upon success.

    Asynchronously copies the entire directory structure from src to dest, including subdirectories and files.

    When copying a directory to another directory, globs are not supported and behavior is similar to cp dir1/ dir2/.