Skip to content

Commit 3c34587

Browse files
as-comarcanis
authored andcommitted
Use UV_FS_COPYFILE_FICLONE flag in fs.copyFile when available (#6302)
* Use UV_FS_COPYFILE_FICLONE flag in fs.copyFile when available * Satisfy Flow * Update fs-normalized.js
1 parent a72ecda commit 3c34587

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util/fs-normalized.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ export const unlink: (path: string) => Promise<void> = promisify(require('rimraf
3636
* to force the correct naming when the filename has changed only in character-casing. (Jest -> jest).
3737
*/
3838
export const copyFile = async function(data: CopyFileAction, cleanup: () => mixed): Promise<void> {
39+
// $FlowFixMe: Flow doesn't currently support COPYFILE_FICLONE
40+
const ficloneFlag = fs.constants.COPYFILE_FICLONE || 0;
3941
try {
4042
await unlink(data.dest);
41-
await copyFilePoly(data.src, data.dest, 0, data);
43+
await copyFilePoly(data.src, data.dest, ficloneFlag, data);
4244
} finally {
4345
if (cleanup) {
4446
cleanup();

0 commit comments

Comments
 (0)