@@ -789,8 +789,7 @@ with an {Error} object. The following example checks if the file
789
789
` / etc/ passwd` can be read and written by the current process.
790
790
791
791
` ` ` mjs
792
- import { access } from ' node:fs/promises' ;
793
- import { constants } from ' node:fs' ;
792
+ import { access , constants } from ' node:fs/promises' ;
794
793
795
794
try {
796
795
await access (' /etc/passwd' , constants .R_OK | constants .W_OK );
@@ -892,8 +891,7 @@ error occurs after the destination file has been opened for writing, an attempt
892
891
will be made to remove the destination.
893
892
894
893
` ` ` mjs
895
- import { constants } from ' node:fs' ;
896
- import { copyFile } from ' node:fs/promises' ;
894
+ import { copyFile , constants } from ' node:fs/promises' ;
897
895
898
896
try {
899
897
await copyFile (' source.txt' , ' destination.txt' );
@@ -1624,6 +1622,14 @@ try {
1624
1622
Aborting an ongoing request does not abort individual operating
1625
1623
system requests but rather the internal buffering `fs.writeFile` performs.
1626
1624
1625
+ ### `fsPromises.constants`
1626
+
1627
+ * {Object}
1628
+
1629
+ Returns an object containing commonly used constants for file system
1630
+ operations. The object is the same as `fs.constants`. See [FS constants][]
1631
+ for more details.
1632
+
1627
1633
## Callback API
1628
1634
1629
1635
The callback APIs perform all operations asynchronously, without blocking the
@@ -6885,7 +6891,7 @@ operations.
6885
6891
6886
6892
#### FS constants
6887
6893
6888
- The following constants are exported by ` fs.constants` .
6894
+ The following constants are exported by ` fs.constants` and ` fsPromises.constants ` .
6889
6895
6890
6896
Not every constant will be available on every operating system;
6891
6897
this is especially important for Windows, where many of the POSIX specific
@@ -7590,6 +7596,7 @@ the file contents.
7590
7596
7591
7597
[#25741]: https://github.com/nodejs/node/issues/25741
7592
7598
[Common System Errors]: errors.md#common-system-errors
7599
+ [FS constants]: #fs-constants
7593
7600
[File access constants]: #file-access-constants
7594
7601
[MDN-Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
7595
7602
[MDN-Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
0 commit comments