@@ -1159,8 +1159,18 @@ operation. If an error occurs after the destination file has been opened for
1159
1159
writing, Node.js will attempt to remove the destination.
1160
1160
1161
1161
` flags ` is an optional integer that specifies the behavior
1162
- of the copy operation. The only supported flag is ` fs.constants.COPYFILE_EXCL ` ,
1163
- which causes the copy operation to fail if ` dest ` already exists.
1162
+ of the copy operation. It is possible to create a mask consisting of the bitwise
1163
+ OR of two or more values (e.g.
1164
+ ` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
1165
+
1166
+ * ` fs.constants.COPYFILE_EXCL ` - The copy operation will fail if ` dest ` already
1167
+ exists.
1168
+ * ` fs.constants.COPYFILE_FICLONE ` - The copy operation will attempt to create a
1169
+ copy-on-write reflink. If the platform does not support copy-on-write, then a
1170
+ fallback copy mechanism is used.
1171
+ * ` fs.constants.COPYFILE_FICLONE_FORCE ` - The copy operation will attempt to
1172
+ create a copy-on-write reflink. If the platform does not support copy-on-write,
1173
+ then the operation will fail.
1164
1174
1165
1175
Example:
1166
1176
@@ -1200,8 +1210,18 @@ atomicity of the copy operation. If an error occurs after the destination file
1200
1210
has been opened for writing, Node.js will attempt to remove the destination.
1201
1211
1202
1212
` flags ` is an optional integer that specifies the behavior
1203
- of the copy operation. The only supported flag is ` fs.constants.COPYFILE_EXCL ` ,
1204
- which causes the copy operation to fail if ` dest ` already exists.
1213
+ of the copy operation. It is possible to create a mask consisting of the bitwise
1214
+ OR of two or more values (e.g.
1215
+ ` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
1216
+
1217
+ * ` fs.constants.COPYFILE_EXCL ` - The copy operation will fail if ` dest ` already
1218
+ exists.
1219
+ * ` fs.constants.COPYFILE_FICLONE ` - The copy operation will attempt to create a
1220
+ copy-on-write reflink. If the platform does not support copy-on-write, then a
1221
+ fallback copy mechanism is used.
1222
+ * ` fs.constants.COPYFILE_FICLONE_FORCE ` - The copy operation will attempt to
1223
+ create a copy-on-write reflink. If the platform does not support copy-on-write,
1224
+ then the operation will fail.
1205
1225
1206
1226
Example:
1207
1227
@@ -3336,6 +3356,34 @@ The following constants are meant for use with [`fs.access()`][].
3336
3356
</tr >
3337
3357
</table >
3338
3358
3359
+ ### File Copy Constants
3360
+
3361
+ The following constants are meant for use with [ ` fs.copyFile() ` ] [ ] .
3362
+
3363
+ <table >
3364
+ <tr >
3365
+ <th>Constant</th>
3366
+ <th>Description</th>
3367
+ </tr >
3368
+ <tr >
3369
+ <td><code>COPYFILE_EXCL</code></td>
3370
+ <td>If present, the copy operation will fail with an error if the
3371
+ destination path already exists.</td>
3372
+ </tr >
3373
+ <tr >
3374
+ <td><code>COPYFILE_FICLONE</code></td>
3375
+ <td>If present, the copy operation will attempt to create a
3376
+ copy-on-write reflink. If the underlying platform does not support
3377
+ copy-on-write, then a fallback copy mechanism is used.</td>
3378
+ </tr >
3379
+ <tr >
3380
+ <td><code>COPYFILE_FICLONE_FORCE</code></td>
3381
+ <td>If present, the copy operation will attempt to create a
3382
+ copy-on-write reflink. If the underlying platform does not support
3383
+ copy-on-write, then the operation will fail with an error.</td>
3384
+ </tr >
3385
+ </table >
3386
+
3339
3387
### File Open Constants
3340
3388
3341
3389
The following constants are meant for use with ` fs.open() ` .
0 commit comments