{ } qjs-modules

fsPromises

Source: lib/fsPromises.js (pure JS)

Promise-based filesystem API mirroring Node's fs/promises. (Several entries are thin stubs delegating to the synchronous fs module.)

Exports

All functions return promises.

FunctionArgsDescription
open(filename, flags='r', mode=0o644)1–3Opens a file, resolving to a handle.
read(fd, buf, offset, length)4Reads into a buffer.
write(fd, buf, offset, length)4Writes from a buffer.
readFile(file, options)1–2Reads an entire file.
writeFile(file, data, overwrite=true)2–3Writes an entire file.
appendFile(path, data)2Appends to a file.
readAll(input, bufSize=1024)1–2Reads a stream to completion.
access(pathname, mode)2Checks accessibility.
stat(path) / lstat(path, options)1–2File status.
readdir(path)1Lists a directory.
opendir(path, options)1–2Opens a directory.
mkdir(path, mode=0o777)1–2Creates a directory.
mkdtemp(prefix, options)1–2Creates a temp directory.
rm(path, options) / rmdir(path, options)1–2Removes a file / directory.
unlink(path)1Removes a file.
rename(oldname, newname)2Renames.
truncate(path, len)2Truncates.
copyFile(src, dest, mode) / cp(src, dest, mode)2–3Copies.
link(existingPath, newPath) / symlink(target, path)2Creates links.
readlink(path) / realpath(path)1Resolves links.
chmod(path, mode) / lchmod(path, mode)2Changes mode.
chown(path, uid, gid) / lchown(path, uid, gid)3Changes ownership.
utimes(path, atime, mtime) / lutimes(path, atime, mtime)3Sets timestamps.
watch(filename, options, callback)1–3Watches a path for changes.