fs: fs.cp() should try copy-on-write if the platform supports it by tetsuharuohzeki · Pull Request #47074 · nodejs/node

@tetsuharuohzeki

fs.cp() and fs.cpSync() should use fs.constants.COPYFILE_FICLONE mode flag to try copy-on-write for copying a file if the platform supports its operation.

@tetsuharuohzeki

`fs.cp()` and `fs.cpSync()` should use
`fs.constants.COPYFILE_FICLONE` mode flag to try to use
copy-on-write for copying a file
if the platform supports its operation.

cjihrig


function copyFile(srcStat, src, dest, opts) {
copyFileSync(src, dest);
copyFileSync(src, dest, COPYFILE_FICLONE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like something that users should pass in via cp()'s options argument, and not something that Node core sets unconditionally.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I withdeaw this pr. Thank you for your review!