FilesystemPromiseAPI
Node API: Filesystem (Promises)
The fs/promises
API provides asynchronous file system methods that return promises.
The promise APIs use the underlying Node.js thread pool to perform file system operations off the event loop thread. These operations are not synchronized or threadsafe. Care must be taken when performing multiple concurrent modifications on the same file or data corruption may occur.
See also
for non-promise filesystem methods.
Inheritors
Functions
Tests a user's permissions for the file or directory specified by path. The mode
argument is an optional integer that specifies the accessibility checks to be performed. mode
should be either the value fs.constants.F_OK
or a mask consisting of the bitwise OR of any of fs.constants.R_OK
,fs.constants.W_OK
, and fs.constants.X_OK
(e.g. fs.constants.W_OK | fs.constants.R_OK
).
Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK
or a mask consisting of the bitwise OR of any of fs.constants.R_OK
,fs.constants.W_OK
, and fs.constants.X_OK
(e.g. fs.constants.W_OK | fs.constants.R_OK
).
Reads the contents of a file at the specified path; provides the results or an error to the callback. This variant accepts a polyglot Value.