Skip to content

Commit 9b146de

Browse files
committed
fix(purescript-node#81): add copyFile_NO_FLAGS, make it default
1 parent 602a6a8 commit 9b146de

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Node/FS/Constants.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { constants } from "node:fs";
22

33
export const f_OK = constants.F_OK;
4-
54
export const r_OK = constants.R_OK;
6-
75
export const w_OK = constants.W_OK;
8-
96
export const x_OK = constants.X_OK;
107

8+
export const copyFile_NO_FLAGS = 0;
119
export const copyFile_EXCL = constants.COPYFILE_EXCL;
12-
1310
export const copyFile_FICLONE = constants.COPYFILE_FICLONE;
14-
1511
export const copyFile_FICLONE_FORCE = constants.COPYFILE_FICLONE_FORCE;
1612

1713
export const appendCopyMode = (l, r) => l | r;

src/Node/FS/Constants.purs

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Data.Function.Uncurried (Fn2, runFn2)
77
-- | the mode parameter passed to `access` and `accessSync`.
88
foreign import data AccessMode :: Type
99

10-
-- | the file is visible to the calling process.
10+
-- | the file is visible to the calling process.
1111
-- | This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.
1212
foreign import f_OK :: AccessMode
1313

@@ -25,6 +25,9 @@ defaultAccessMode = f_OK :: AccessMode
2525
-- | A constant used in `copyFile`.
2626
foreign import data CopyMode :: Type
2727

28+
-- | By default, `dest` is overwritten if it already exists.
29+
foreign import copyFile_NO_FLAGS :: CopyMode
30+
2831
-- | If present, the copy operation will fail with an error if the destination path already exists.
2932
foreign import copyFile_EXCL :: CopyMode
3033

@@ -34,7 +37,7 @@ foreign import copyFile_FICLONE :: CopyMode
3437
-- | 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.
3538
foreign import copyFile_FICLONE_FORCE :: CopyMode
3639

37-
defaultCopyMode = copyFile_EXCL :: CopyMode
40+
defaultCopyMode = copyFile_NO_FLAGS :: CopyMode
3841

3942
foreign import appendCopyMode :: Fn2 CopyMode CopyMode CopyMode
4043

@@ -88,4 +91,3 @@ fileFlagsToNode ff = case ff of
8891
AX -> "ax"
8992
A_PLUS -> "a+"
9093
AX_PLUS -> "ax+"
91-

0 commit comments

Comments
 (0)