@@ -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' );
@@ -1622,6 +1620,14 @@ try {
1622
1620
Aborting an ongoing request does not abort individual operating
1623
1621
system requests but rather the internal buffering `fs.writeFile` performs.
1624
1622
1623
+ ### `fsPromises.constants`
1624
+
1625
+ * {Object}
1626
+
1627
+ Returns an object containing commonly used constants for file system
1628
+ operations. The object is the same as `fs.constants`. See [FS constants][]
1629
+ for more details.
1630
+
1625
1631
## Callback API
1626
1632
1627
1633
The callback APIs perform all operations asynchronously, without blocking the
@@ -6879,7 +6885,7 @@ operations.
6879
6885
6880
6886
#### FS constants
6881
6887
6882
- The following constants are exported by ` fs.constants` .
6888
+ The following constants are exported by ` fs.constants` and ` fsPromises.constants ` .
6883
6889
6884
6890
Not every constant will be available on every operating system;
6885
6891
this is especially important for Windows, where many of the POSIX specific
@@ -7584,6 +7590,7 @@ the file contents.
7584
7590
7585
7591
[#25741]: https://github.com/nodejs/node/issues/25741
7586
7592
[Common System Errors]: errors.md#common-system-errors
7593
+ [FS constants]: #fs-constants
7587
7594
[File access constants]: #file-access-constants
7588
7595
[MDN-Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
7589
7596
[MDN-Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
0 commit comments