Fcp
Bun

function

fs.promises.cp

function cp(
source: string | URL,
destination: string | URL,
): Promise<void>;

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/.

@returns

Fulfills with undefined upon success.

Referenced types

class URL

The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

interface CopyOptions

  • dereference?: boolean

    Dereference symlinks

  • errorOnExist?: boolean

    When force is false, and the destination exists, throw an error.

  • filter?: (source: string, destination: string) => boolean | Promise<boolean>

    Function to filter copied files/directories. Return true to copy the item, false to ignore it.

  • 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.

  • mode?: number

    Modifiers for copy operation. See mode flag of ()

  • preserveTimestamps?: boolean

    When true timestamps from src will be preserved.

  • recursive?: boolean

    Copy directories recursively.