@@ -1556,14 +1556,14 @@ Returns an object containing commonly used constants for file system
1556
1556
operations. The specific constants currently defined are described in
1557
1557
[ FS Constants] [ ] .
1558
1558
1559
- ## ` fs.copyFile(src, dest[, flags ], callback) `
1559
+ ## ` fs.copyFile(src, dest[, mode ], callback) `
1560
1560
<!-- YAML
1561
1561
added: v8.5.0
1562
1562
-->
1563
1563
1564
1564
* ` src ` {string|Buffer|URL} source filename to copy
1565
1565
* ` dest ` {string|Buffer|URL} destination filename of the copy operation
1566
- * ` flags ` {number } modifiers for copy operation. ** Default:** ` 0 ` .
1566
+ * ` mode ` {integer } modifiers for copy operation. ** Default:** ` 0 ` .
1567
1567
* ` callback ` {Function}
1568
1568
1569
1569
Asynchronously copies ` src ` to ` dest ` . By default, ` dest ` is overwritten if it
@@ -1572,7 +1572,7 @@ callback function. Node.js makes no guarantees about the atomicity of the copy
1572
1572
operation. If an error occurs after the destination file has been opened for
1573
1573
writing, Node.js will attempt to remove the destination.
1574
1574
1575
- ` flags ` is an optional integer that specifies the behavior
1575
+ ` mode ` is an optional integer that specifies the behavior
1576
1576
of the copy operation. It is possible to create a mask consisting of the bitwise
1577
1577
OR of two or more values (e.g.
1578
1578
` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
@@ -1596,7 +1596,7 @@ fs.copyFile('source.txt', 'destination.txt', (err) => {
1596
1596
});
1597
1597
```
1598
1598
1599
- If the third argument is a number, then it specifies ` flags ` :
1599
+ If the third argument is a number, then it specifies ` mode ` :
1600
1600
1601
1601
``` js
1602
1602
const fs = require (' fs' );
@@ -1606,21 +1606,21 @@ const { COPYFILE_EXCL } = fs.constants;
1606
1606
fs .copyFile (' source.txt' , ' destination.txt' , COPYFILE_EXCL , callback);
1607
1607
```
1608
1608
1609
- ## ` fs.copyFileSync(src, dest[, flags ]) `
1609
+ ## ` fs.copyFileSync(src, dest[, mode ]) `
1610
1610
<!-- YAML
1611
1611
added: v8.5.0
1612
1612
-->
1613
1613
1614
1614
* ` src ` {string|Buffer|URL} source filename to copy
1615
1615
* ` dest ` {string|Buffer|URL} destination filename of the copy operation
1616
- * ` flags ` {number } modifiers for copy operation. ** Default:** ` 0 ` .
1616
+ * ` mode ` {integer } modifiers for copy operation. ** Default:** ` 0 ` .
1617
1617
1618
1618
Synchronously copies ` src ` to ` dest ` . By default, ` dest ` is overwritten if it
1619
1619
already exists. Returns ` undefined ` . Node.js makes no guarantees about the
1620
1620
atomicity of the copy operation. If an error occurs after the destination file
1621
1621
has been opened for writing, Node.js will attempt to remove the destination.
1622
1622
1623
- ` flags ` is an optional integer that specifies the behavior
1623
+ ` mode ` is an optional integer that specifies the behavior
1624
1624
of the copy operation. It is possible to create a mask consisting of the bitwise
1625
1625
OR of two or more values (e.g.
1626
1626
` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
@@ -1642,7 +1642,7 @@ fs.copyFileSync('source.txt', 'destination.txt');
1642
1642
console .log (' source.txt was copied to destination.txt' );
1643
1643
```
1644
1644
1645
- If the third argument is a number, then it specifies ` flags ` :
1645
+ If the third argument is a number, then it specifies ` mode ` :
1646
1646
1647
1647
``` js
1648
1648
const fs = require (' fs' );
@@ -1796,12 +1796,11 @@ changes:
1796
1796
* ` fs ` {Object|null} ** Default:** ` null `
1797
1797
* Returns: {fs.WriteStream} See [ Writable Stream] [ ] .
1798
1798
1799
- ` options ` may also include a ` start ` option to allow writing data at
1800
- some position past the beginning of the file, allowed values are in the
1801
- [ 0, [ ` Number.MAX_SAFE_INTEGER ` ] [ ]] range. Modifying a file rather
1802
- than replacing it may require a ` flags ` mode of ` r+ ` rather than the
1803
- default mode ` w ` . The ` encoding ` can be any one of those accepted by
1804
- [ ` Buffer ` ] [ ] .
1799
+ ` options ` may also include a ` start ` option to allow writing data at some
1800
+ position past the beginning of the file, allowed values are in the
1801
+ [ 0, [ ` Number.MAX_SAFE_INTEGER ` ] [ ]] range. Modifying a file rather than replacing
1802
+ it may require the ` flags ` option to be set to ` r+ ` rather than the default ` w ` .
1803
+ The ` encoding ` can be any one of those accepted by [ ` Buffer ` ] [ ] .
1805
1804
1806
1805
If ` autoClose ` is set to true (default behavior) on ` 'error' ` or ` 'finish' `
1807
1806
the file descriptor will be closed automatically. If ` autoClose ` is false,
@@ -2466,7 +2465,7 @@ changes:
2466
2465
Asynchronously creates a directory. No arguments other than a possible exception
2467
2466
are given to the completion callback.
2468
2467
2469
- The optional ` options ` argument can be an integer specifying mode (permission
2468
+ The optional ` options ` argument can be an integer specifying ` mode ` (permission
2470
2469
and sticky bits), or an object with a ` mode ` property and a ` recursive `
2471
2470
property indicating whether parent folders should be created. Calling
2472
2471
` fs.mkdir() ` when ` path ` is a directory that exists results in an error only
@@ -2617,7 +2616,7 @@ changes:
2617
2616
description: The `flags` argument is now optional and defaults to `'r'`.
2618
2617
- version: v9.9.0
2619
2618
pr-url: https://github.com/nodejs/node/pull/18801
2620
- description: The `as` and `as+` modes are supported now.
2619
+ description: The `as` and `as+` flags are supported now.
2621
2620
- version: v7.6.0
2622
2621
pr-url: https://github.com/nodejs/node/pull/10739
2623
2622
description: The `path` parameter can be a WHATWG `URL` object using `file:`
@@ -2709,7 +2708,7 @@ changes:
2709
2708
description: The `flags` argument is now optional and defaults to `'r'`.
2710
2709
- version: v9.9.0
2711
2710
pr-url: https://github.com/nodejs/node/pull/18801
2712
- description: The `as` and `as+` modes are supported now.
2711
+ description: The `as` and `as+` flags are supported now.
2713
2712
- version: v7.6.0
2714
2713
pr-url: https://github.com/nodejs/node/pull/10739
2715
2714
description: The `path` parameter can be a WHATWG `URL` object using `file:`
@@ -3276,16 +3275,16 @@ changes:
3276
3275
* ` path ` {string|Buffer|URL}
3277
3276
* ` options ` {Object}
3278
3277
* ` maxRetries ` {integer} If an ` EBUSY ` , ` EMFILE ` , ` ENFILE ` , ` ENOTEMPTY ` , or
3279
- ` EPERM ` error is encountered, Node.js will retry the operation with a linear
3280
- backoff wait of ` retryDelay ` ms longer on each try. This option represents the
3281
- number of retries. This option is ignored if the ` recursive ` option is not
3282
- ` true ` . ** Default:** ` 0 ` .
3278
+ ` EPERM ` error is encountered, Node.js will retry the operation with a linear
3279
+ backoff wait of ` retryDelay ` ms longer on each try. This option represents
3280
+ the number of retries. This option is ignored if the ` recursive ` option is
3281
+ not ` true ` . ** Default:** ` 0 ` .
3283
3282
* ` recursive ` {boolean} If ` true ` , perform a recursive directory removal. In
3284
- recursive mode, errors are not reported if ` path ` does not exist, and
3285
- operations are retried on failure. ** Default:** ` false ` .
3283
+ recursive mode, errors are not reported if ` path ` does not exist, and
3284
+ operations are retried on failure. ** Default:** ` false ` .
3286
3285
* ` retryDelay ` {integer} The amount of time in milliseconds to wait between
3287
- retries. This option is ignored if the ` recursive ` option is not ` true ` .
3288
- ** Default:** ` 100 ` .
3286
+ retries. This option is ignored if the ` recursive ` option is not ` true ` .
3287
+ ** Default:** ` 100 ` .
3289
3288
* ` callback ` {Function}
3290
3289
* ` err ` {Error}
3291
3290
@@ -3321,16 +3320,16 @@ changes:
3321
3320
* ` path ` {string|Buffer|URL}
3322
3321
* ` options ` {Object}
3323
3322
* ` maxRetries ` {integer} If an ` EBUSY ` , ` EMFILE ` , ` ENFILE ` , ` ENOTEMPTY ` , or
3324
- ` EPERM ` error is encountered, Node.js will retry the operation with a linear
3325
- backoff wait of ` retryDelay ` ms longer on each try. This option represents the
3326
- number of retries. This option is ignored if the ` recursive ` option is not
3327
- ` true ` . ** Default:** ` 0 ` .
3323
+ ` EPERM ` error is encountered, Node.js will retry the operation with a linear
3324
+ backoff wait of ` retryDelay ` ms longer on each try. This option represents
3325
+ the number of retries. This option is ignored if the ` recursive ` option is
3326
+ not ` true ` . ** Default:** ` 0 ` .
3328
3327
* ` recursive ` {boolean} If ` true ` , perform a recursive directory removal. In
3329
- recursive mode, errors are not reported if ` path ` does not exist, and
3330
- operations are retried on failure. ** Default:** ` false ` .
3328
+ recursive mode, errors are not reported if ` path ` does not exist, and
3329
+ operations are retried on failure. ** Default:** ` false ` .
3331
3330
* ` retryDelay ` {integer} The amount of time in milliseconds to wait between
3332
- retries. This option is ignored if the ` recursive ` option is not ` true ` .
3333
- ** Default:** ` 100 ` .
3331
+ retries. This option is ignored if the ` recursive ` option is not ` true ` .
3332
+ ** Default:** ` 100 ` .
3334
3333
3335
3334
Synchronous rmdir(2). Returns ` undefined ` .
3336
3335
@@ -4687,14 +4686,14 @@ added: v10.0.0
4687
4686
Changes the ownership of a file then resolves the ` Promise ` with no arguments
4688
4687
upon success.
4689
4688
4690
- ### ` fsPromises.copyFile(src, dest[, flags ]) `
4689
+ ### ` fsPromises.copyFile(src, dest[, mode ]) `
4691
4690
<!-- YAML
4692
4691
added: v10.0.0
4693
4692
-->
4694
4693
4695
4694
* ` src ` {string|Buffer|URL} source filename to copy
4696
4695
* ` dest ` {string|Buffer|URL} destination filename of the copy operation
4697
- * ` flags ` {number } modifiers for copy operation. ** Default:** ` 0 ` .
4696
+ * ` mode ` {integer } modifiers for copy operation. ** Default:** ` 0 ` .
4698
4697
* Returns: {Promise}
4699
4698
4700
4699
Asynchronously copies ` src ` to ` dest ` . By default, ` dest ` is overwritten if it
@@ -4704,7 +4703,7 @@ Node.js makes no guarantees about the atomicity of the copy operation. If an
4704
4703
error occurs after the destination file has been opened for writing, Node.js
4705
4704
will attempt to remove the destination.
4706
4705
4707
- ` flags ` is an optional integer that specifies the behavior
4706
+ ` mode ` is an optional integer that specifies the behavior
4708
4707
of the copy operation. It is possible to create a mask consisting of the bitwise
4709
4708
OR of two or more values (e.g.
4710
4709
` fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE ` ).
@@ -4727,7 +4726,7 @@ fsPromises.copyFile('source.txt', 'destination.txt')
4727
4726
.catch (() => console .log (' The file could not be copied' ));
4728
4727
```
4729
4728
4730
- If the third argument is a number, then it specifies ` flags ` :
4729
+ If the third argument is a number, then it specifies ` mode ` :
4731
4730
4732
4731
``` js
4733
4732
const fs = require (' fs' );
@@ -4813,7 +4812,7 @@ added: v10.0.0
4813
4812
Asynchronously creates a directory then resolves the ` Promise ` with no
4814
4813
arguments upon success.
4815
4814
4816
- The optional ` options ` argument can be an integer specifying mode (permission
4815
+ The optional ` options ` argument can be an integer specifying ` mode ` (permission
4817
4816
and sticky bits), or an object with a ` mode ` property and a ` recursive `
4818
4817
property indicating whether parent folders should be created. Calling
4819
4818
` fsPromises.mkdir() ` when ` path ` is a directory that exists results in a
@@ -5044,16 +5043,16 @@ changes:
5044
5043
* ` path ` {string|Buffer|URL}
5045
5044
* ` options ` {Object}
5046
5045
* ` maxRetries ` {integer} If an ` EBUSY ` , ` EMFILE ` , ` ENFILE ` , ` ENOTEMPTY ` , or
5047
- ` EPERM ` error is encountered, Node.js will retry the operation with a linear
5048
- backoff wait of ` retryDelay ` ms longer on each try. This option represents the
5049
- number of retries. This option is ignored if the ` recursive ` option is not
5050
- ` true ` . ** Default:** ` 0 ` .
5046
+ ` EPERM ` error is encountered, Node.js will retry the operation with a linear
5047
+ backoff wait of ` retryDelay ` ms longer on each try. This option represents
5048
+ the number of retries. This option is ignored if the ` recursive ` option is
5049
+ not ` true ` . ** Default:** ` 0 ` .
5051
5050
* ` recursive ` {boolean} If ` true ` , perform a recursive directory removal. In
5052
- recursive mode, errors are not reported if ` path ` does not exist, and
5053
- operations are retried on failure. ** Default:** ` false ` .
5051
+ recursive mode, errors are not reported if ` path ` does not exist, and
5052
+ operations are retried on failure. ** Default:** ` false ` .
5054
5053
* ` retryDelay ` {integer} The amount of time in milliseconds to wait between
5055
- retries. This option is ignored if the ` recursive ` option is not ` true ` .
5056
- ** Default:** ` 100 ` .
5054
+ retries. This option is ignored if the ` recursive ` option is not ` true ` .
5055
+ ** Default:** ` 100 ` .
5057
5056
* Returns: {Promise}
5058
5057
5059
5058
Removes the directory identified by ` path ` then resolves the ` Promise ` with
@@ -5541,7 +5540,7 @@ the file contents.
5541
5540
[ `fs.access()` ] : #fs_fs_access_path_mode_callback
5542
5541
[ `fs.chmod()` ] : #fs_fs_chmod_path_mode_callback
5543
5542
[ `fs.chown()` ] : #fs_fs_chown_path_uid_gid_callback
5544
- [ `fs.copyFile()` ] : #fs_fs_copyfile_src_dest_flags_callback
5543
+ [ `fs.copyFile()` ] : #fs_fs_copyfile_src_dest_mode_callback
5545
5544
[ `fs.createWriteStream()` ] : #fs_fs_createwritestream_path_options
5546
5545
[ `fs.exists()` ] : fs.html#fs_fs_exists_path_callback
5547
5546
[ `fs.fstat()` ] : #fs_fs_fstat_fd_options_callback
0 commit comments