@@ -1175,8 +1175,18 @@ operation. If an error occurs after the destination file has been opened for
1175
1175
writing, Node.js will attempt to remove the destination.
1176
1176
1177
1177
` flags ` is an optional integer that specifies the behavior
1178
- of the copy operation. The only supported flag is ` fs.constants.COPYFILE_EXCL ` ,
1179
- which causes the copy operation to fail if ` dest ` already exists.
1178
+ of the copy operation. It is possible to create a mask consisting of the bitwise
1179
+ OR of two or more values (e.g.
1180
+ ` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
1181
+
1182
+ * ` fs.constants.COPYFILE_EXCL ` - The copy operation will fail if ` dest ` already
1183
+ exists.
1184
+ * ` fs.constants.COPYFILE_FICLONE ` - The copy operation will attempt to create a
1185
+ copy-on-write reflink. If the platform does not support copy-on-write, then a
1186
+ fallback copy mechanism is used.
1187
+ * ` fs.constants.COPYFILE_FICLONE_FORCE ` - The copy operation will attempt to
1188
+ create a copy-on-write reflink. If the platform does not support copy-on-write,
1189
+ then the operation will fail.
1180
1190
1181
1191
Example:
1182
1192
@@ -1216,8 +1226,18 @@ atomicity of the copy operation. If an error occurs after the destination file
1216
1226
has been opened for writing, Node.js will attempt to remove the destination.
1217
1227
1218
1228
` flags ` is an optional integer that specifies the behavior
1219
- of the copy operation. The only supported flag is ` fs.constants.COPYFILE_EXCL ` ,
1220
- which causes the copy operation to fail if ` dest ` already exists.
1229
+ of the copy operation. It is possible to create a mask consisting of the bitwise
1230
+ OR of two or more values (e.g.
1231
+ ` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
1232
+
1233
+ * ` fs.constants.COPYFILE_EXCL ` - The copy operation will fail if ` dest ` already
1234
+ exists.
1235
+ * ` fs.constants.COPYFILE_FICLONE ` - The copy operation will attempt to create a
1236
+ copy-on-write reflink. If the platform does not support copy-on-write, then a
1237
+ fallback copy mechanism is used.
1238
+ * ` fs.constants.COPYFILE_FICLONE_FORCE ` - The copy operation will attempt to
1239
+ create a copy-on-write reflink. If the platform does not support copy-on-write,
1240
+ then the operation will fail.
1221
1241
1222
1242
Example:
1223
1243
@@ -3814,8 +3834,18 @@ error occurs after the destination file has been opened for writing, Node.js
3814
3834
will attempt to remove the destination.
3815
3835
3816
3836
` flags ` is an optional integer that specifies the behavior
3817
- of the copy operation. The only supported flag is ` fs.constants.COPYFILE_EXCL ` ,
3818
- which causes the copy operation to fail if ` dest ` already exists.
3837
+ of the copy operation. It is possible to create a mask consisting of the bitwise
3838
+ OR of two or more values (e.g.
3839
+ ` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
3840
+
3841
+ * ` fs.constants.COPYFILE_EXCL ` - The copy operation will fail if ` dest ` already
3842
+ exists.
3843
+ * ` fs.constants.COPYFILE_FICLONE ` - The copy operation will attempt to create a
3844
+ copy-on-write reflink. If the platform does not support copy-on-write, then a
3845
+ fallback copy mechanism is used.
3846
+ * ` fs.constants.COPYFILE_FICLONE_FORCE ` - The copy operation will attempt to
3847
+ create a copy-on-write reflink. If the platform does not support copy-on-write,
3848
+ then the operation will fail.
3819
3849
3820
3850
Example:
3821
3851
@@ -4449,6 +4479,34 @@ The following constants are meant for use with [`fs.access()`][].
4449
4479
</tr >
4450
4480
</table >
4451
4481
4482
+ ### File Copy Constants
4483
+
4484
+ The following constants are meant for use with [ ` fs.copyFile() ` ] [ ] .
4485
+
4486
+ <table >
4487
+ <tr >
4488
+ <th>Constant</th>
4489
+ <th>Description</th>
4490
+ </tr >
4491
+ <tr >
4492
+ <td><code>COPYFILE_EXCL</code></td>
4493
+ <td>If present, the copy operation will fail with an error if the
4494
+ destination path already exists.</td>
4495
+ </tr >
4496
+ <tr >
4497
+ <td><code>COPYFILE_FICLONE</code></td>
4498
+ <td>If present, the copy operation will attempt to create a
4499
+ copy-on-write reflink. If the underlying platform does not support
4500
+ copy-on-write, then a fallback copy mechanism is used.</td>
4501
+ </tr >
4502
+ <tr >
4503
+ <td><code>COPYFILE_FICLONE_FORCE</code></td>
4504
+ <td>If present, the copy operation will attempt to create a
4505
+ copy-on-write reflink. If the underlying platform does not support
4506
+ copy-on-write, then the operation will fail with an error.</td>
4507
+ </tr >
4508
+ </table >
4509
+
4452
4510
### File Open Constants
4453
4511
4454
4512
The following constants are meant for use with ` fs.open() ` .
0 commit comments