Skip to main content

Module fs

Module fs 

Source
Expand description

Bindings to the Node.js fs and fs/promises modules for file system access.

Structs§

Fs
Binding to the Node.js fs module, exposing the synchronous (*Sync) file system API.
FsPromises
Binding to the Node.js fs/promises module, exposing the promise-based (asynchronous) file system API.

Functions§

exists_sync
Synchronously returns true if a file system entry exists at path.
mkdir_sync
Synchronously creates the directory at path, honouring the supplied options (e.g. recursive, mode).
read_file_sync
Synchronously reads and returns the contents of the file at path. The returned value is a Buffer, or a string when an encoding is given in options.
readdir
Asynchronously reads the contents of the directory at path, returning an array of the names of the entries it contains.
readdir_sync
Reads the contents of the directory at path, delivering the resulting entries to the supplied JavaScript callback.
readdir_with_options
Asynchronously reads the contents of the directory at path, applying the given options (e.g. withFileTypes, recursive, encoding).
rename_sync
Synchronously renames (moves) the file or directory from from to to.
stat_sync
Synchronously retrieves the fs.Stats object describing the file system entry at path.
unlink_sync
Synchronously removes the file (or symbolic link) at path.
write_file_sync
Synchronously writes data to the file at path, creating or replacing it according to the supplied options (e.g. encoding, mode, flag).