You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run Node.FS.Aff.copyFile, it fails when the file already exists.
That's because of the definition of defaultCopyMode which uses the fs.constants.COPYFILE_EXCL flag.
There's two issues:
(1) The default is inconsistent with the underlying node API. fs.copyFile without a specified copy mode operates as if no flags were applied. It allows overwriting files on copy.
Pros: it matches the node default.
Cons: it's a breaking change, requires a version bump and is surprising to people who relied on the old behavior.
(2)
Simply define and export this definition, but don't change defaultCopyMode. And apply some doc comments that explain the difference between noFlagsCopyMode and defaultCopyMode
// Constants.jsexportnoFlagsCopyMode=0;
Pros: It's safer to have people opt-in
Cons: Not a 1:1 with the node docs.
Activity
CharlesTaylor7 commentedon Oct 9, 2023
I have two ideas in mind for how to resolve this:
(1)
Redefine
defaultCopyMode:Pros: it matches the node default.
Cons: it's a breaking change, requires a version bump and is surprising to people who relied on the old behavior.
(2)
Simply define and export this definition, but don't change
defaultCopyMode. And apply some doc comments that explain the difference betweennoFlagsCopyModeanddefaultCopyModePros: It's safer to have people opt-in
Cons: Not a 1:1 with the node docs.