Skip to content

Impossible to overwrite files with copyFile #81

Open
@CharlesTaylor7

Description

@CharlesTaylor7

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.

https://nodejs.org/api/fs.html#fscopyfilesrc-dest-mode-callback

Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

(2) There's no way to use this library to get at the node default behavior.

The structure of the Node.FS.Constants api only allows appending flags not removing them.
There's no export of a "noFlags :: CopyMode".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions