@@ -789,8 +789,7 @@ with an {Error} object. The following example checks if the file
789789` / etc/ passwd` can be read and written by the current process.
790790
791791` ` ` mjs
792- import { access } from ' node:fs/promises' ;
793- import { constants } from ' node:fs' ;
792+ import { access , constants } from ' node:fs/promises' ;
794793
795794try {
796795 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
892891will be made to remove the destination.
893892
894893` ` ` mjs
895- import { constants } from ' node:fs' ;
896- import { copyFile } from ' node:fs/promises' ;
894+ import { copyFile , constants } from ' node:fs/promises' ;
897895
898896try {
899897 await copyFile (' source.txt' , ' destination.txt' );
@@ -1622,6 +1620,14 @@ try {
16221620Aborting an ongoing request does not abort individual operating
16231621system requests but rather the internal buffering `fs.writeFile` performs.
16241622
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+
16251631## Callback API
16261632
16271633The callback APIs perform all operations asynchronously, without blocking the
@@ -6879,7 +6885,7 @@ operations.
68796885
68806886#### FS constants
68816887
6882- The following constants are exported by ` fs.constants` .
6888+ The following constants are exported by ` fs.constants` and ` fsPromises.constants ` .
68836889
68846890Not every constant will be available on every operating system;
68856891this is especially important for Windows, where many of the POSIX specific
@@ -7584,6 +7590,7 @@ the file contents.
75847590
75857591[#25741]: https://github.com/nodejs/node/issues/25741
75867592[Common System Errors]: errors.md#common-system-errors
7593+ [FS constants]: #fs-constants
75877594[File access constants]: #file-access-constants
75887595[MDN-Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
75897596[MDN-Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type
0 commit comments