文件复制的常量


以下常量旨在与 fs.copyFile() 一起使用。

常量 描述
COPYFILE_EXCL 如果存在,如果目标路径已经存在,复制操作将失败并显示错误。
COPYFILE_FICLONE 如果存在,复制操作将尝试创建写时复制引用链接。 如果底层平台不支持写时复制,则使用回退复制机制。
COPYFILE_FICLONE_FORCE 如果存在,复制操作将尝试创建写时复制引用链接。 如果底层平台不支持写时复制,则操作将失败并显示错误。

The following constants are meant for use with fs.copyFile().

Constant Description
COPYFILE_EXCL If present, the copy operation will fail with an error if the destination path already exists.
COPYFILE_FICLONE If present, the copy operation will attempt to create a copy-on-write reflink. If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used.
COPYFILE_FICLONE_FORCE If present, the copy operation will attempt to create a copy-on-write reflink. If the underlying platform does not support copy-on-write, then the operation will fail with an error.