nodeColonfsMod

class Object
trait Matchable
class Any

Value members

Concrete methods

@inline
def access(path: PathLike): Promise[Unit]

Asynchronously tests a user's permissions for the file specified by path.

Asynchronously tests a user's permissions for the file specified by path.

Value Params
path

A path to a file or directory. If a URL is provided, it must use the file: protocol. URL support is experimental.

@inline
def access(path: PathLike, mode: Double): Promise[Unit]
@inline
def appendFile(path: PathLike, data: String): Promise[Unit]

Asynchronously append data to a file, creating the file if it does not exist.

Asynchronously append data to a file, creating the file if it does not exist.

Value Params
data

The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.

file

A path to a file. If a URL is provided, it must use the file: protocol. URL support is experimental. If a FileHandle is provided, the underlying file will not be closed automatically.

options

Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. If encoding is not supplied, the default of 'utf8' is used. If mode is not supplied, the default of 0o666 is used. If mode is a string, it is parsed as an octal integer. If flag is not supplied, the default of 'a' is used.

@inline
def appendFile(path: PathLike, data: String, options: BaseEncodingOptionsmodeMoEncoding): Promise[Unit]
@inline
def appendFile(path: PathLike, data: String, options: BufferEncoding): Promise[Unit]
@inline
def appendFile(path: PathLike, data: Uint8Array): Promise[Unit]
@inline
def appendFile(path: PathLike, data: Uint8Array, options: BaseEncodingOptionsmodeMoEncoding): Promise[Unit]
@inline
def appendFile(path: PathLike, data: Uint8Array, options: BufferEncoding): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: String): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: String, options: BaseEncodingOptionsmodeMoEncoding): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: String, options: BufferEncoding): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: Uint8Array): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: Uint8Array, options: BaseEncodingOptionsmodeMoEncoding): Promise[Unit]
@inline
def appendFile(path: FileHandle, data: Uint8Array, options: BufferEncoding): Promise[Unit]
@inline
def chmod(path: PathLike, mode: Mode): Promise[Unit]

Asynchronous chmod(2) - Change permissions of a file.

Asynchronous chmod(2) - Change permissions of a file.

Value Params
mode

A file mode. If a string is passed, it is parsed as an octal integer.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def chown(path: PathLike, uid: Double, gid: Double): Promise[Unit]

Asynchronous chown(2) - Change ownership of a file.

Asynchronous chown(2) - Change ownership of a file.

Value Params
path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def copyFile(src: PathLike, dest: PathLike): Promise[Unit]

Asynchronously copies src to dest. By default, dest is overwritten if it already exists. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

Asynchronously copies src to dest. By default, dest is overwritten if it already exists. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination.

Value Params
dest

A path to the destination file.

flags

An optional integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.

src

A path to the source file.

@inline
def copyFile(src: PathLike, dest: PathLike, flags: Double): Promise[Unit]
@inline
def fchmod(handle: FileHandle, mode: Mode): Promise[Unit]

Asynchronous fchmod(2) - Change permissions of a file.

Asynchronous fchmod(2) - Change permissions of a file.

Value Params
handle

A FileHandle.

mode

A file mode. If a string is passed, it is parsed as an octal integer.

@inline
def fchown(handle: FileHandle, uid: Double, gid: Double): Promise[Unit]

Asynchronous fchown(2) - Change ownership of a file.

Asynchronous fchown(2) - Change ownership of a file.

Value Params
handle

A FileHandle.

@inline
def fdatasync(handle: FileHandle): Promise[Unit]

Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.

Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.

Value Params
handle

A FileHandle.

@inline
def fsync(handle: FileHandle): Promise[Unit]

Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.

Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.

Value Params
handle

A FileHandle.

@inline
def ftruncate(handle: FileHandle): Promise[Unit]

Asynchronous ftruncate(2) - Truncate a file to a specified length.

Asynchronous ftruncate(2) - Truncate a file to a specified length.

Value Params
handle

A FileHandle.

len

If not specified, defaults to 0.

@inline
def ftruncate(handle: FileHandle, len: Double): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: String, mtime: String): Promise[Unit]

Asynchronously change file timestamps of the file referenced by the supplied FileHandle.

Asynchronously change file timestamps of the file referenced by the supplied FileHandle.

Value Params
atime

The last access time. If a string is provided, it will be coerced to number.

handle

A FileHandle.

mtime

The last modified time. If a string is provided, it will be coerced to number.

@inline
def futimes(handle: FileHandle, atime: String, mtime: Date): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: String, mtime: Double): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Date, mtime: String): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Date, mtime: Date): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Date, mtime: Double): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Double, mtime: String): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Double, mtime: Date): Promise[Unit]
@inline
def futimes(handle: FileHandle, atime: Double, mtime: Double): Promise[Unit]
@inline
def lchmod(path: PathLike, mode: Mode): Promise[Unit]

Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.

Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.

Value Params
mode

A file mode. If a string is passed, it is parsed as an octal integer.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def lchown(path: PathLike, uid: Double, gid: Double): Promise[Unit]

Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.

Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.

Value Params
path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def lstat(path: PathLike): Promise[Stats]

Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.

Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.

Value Params
path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def lstat(path: PathLike, opts: StatOptionsbigintfalseund): Promise[Stats]
@inline
def lstat(path: PathLike, opts: StatOptionsbiginttrue): Promise[BigIntStats]
@inline
def lstat(path: PathLike, opts: StatOptions): Promise[Stats | BigIntStats]
@inline
def lutimes(path: PathLike, atime: String, mtime: String): Promise[Unit]

Changes the access and modification times of a file in the same way as fsPromises.utimes(), with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

Changes the access and modification times of a file in the same way as fsPromises.utimes(), with the difference that if the path refers to a symbolic link, then the link is not dereferenced: instead, the timestamps of the symbolic link itself are changed.

Value Params
atime

The last access time. If a string is provided, it will be coerced to number.

mtime

The last modified time. If a string is provided, it will be coerced to number.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def lutimes(path: PathLike, atime: String, mtime: Date): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: String, mtime: Double): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Date, mtime: String): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Date, mtime: Date): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Date, mtime: Double): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Double, mtime: String): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Double, mtime: Date): Promise[Unit]
@inline
def lutimes(path: PathLike, atime: Double, mtime: Double): Promise[Unit]
@inline
def mkdir(path: PathLike): Promise[Unit]

Asynchronous mkdir(2) - create a directory.

Asynchronous mkdir(2) - create a directory.

Value Params
options

Either the file mode, or an object optionally specifying the file mode and whether parent folders should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to 0o777.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def mkdir(path: PathLike, options: MakeDirectoryOptionsrecur): Promise[UndefOr[String]]

Asynchronous mkdir(2) - create a directory.

Asynchronous mkdir(2) - create a directory.

Value Params
options

Either the file mode, or an object optionally specifying the file mode and whether parent folders should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to 0o777.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def mkdir(path: PathLike, options: MakeDirectoryOptionsrecurMode): Promise[Unit]
@inline
def mkdir(path: PathLike, options: MakeDirectoryOptions): Promise[UndefOr[String]]
@inline
def mkdir(path: PathLike, options: Mode): Promise[Unit]
@inline
def mkdtemp(prefix: String): Promise[String]

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

@inline
def mkdtemp(prefix: String, options: BufferEncoding): Promise[String]
@inline
def mkdtemp(prefix: String, options: BaseEncodingOptions): Promise[String]
@inline
def mkdtemp(prefix: String, options: BufferEncodingOption): Promise[Buffer]

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

@inline
def open(path: PathLike, flags: String): Promise[FileHandle]

Asynchronous open(2) - open and possibly create a file.

Asynchronous open(2) - open and possibly create a file.

Value Params
mode

A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to 0o666.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def open(path: PathLike, flags: String, mode: Mode): Promise[FileHandle]
@inline
def open(path: PathLike, flags: Double): Promise[FileHandle]
@inline
def open(path: PathLike, flags: Double, mode: Mode): Promise[FileHandle]
@inline
def opendir(path: String): Promise[Dir]
@inline
def opendir(path: String, options: OpenDirOptions): Promise[Dir]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer): Promise[Buffer[TBuffer]]

Asynchronously reads data from the file referenced by the supplied FileHandle.

Asynchronously reads data from the file referenced by the supplied FileHandle.

Value Params
buffer

The buffer that the data will be written to.

handle

A FileHandle.

length

The number of bytes to read.

offset

The offset in the buffer at which to start writing.

position

The offset from the beginning of the file from which data should be read. If null, data will be read from the current position.

@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Double, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Null, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Unit, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Double, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Null, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Unit, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Double, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Null, position: Double): Promise[Buffer[TBuffer]]
@inline
def read[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Unit, position: Double): Promise[Buffer[TBuffer]]
@inline
def readFile(path: PathLike): Promise[Buffer]

Asynchronously reads the entire contents of a file.

Asynchronously reads the entire contents of a file.

Value Params
options

An object that may contain an optional flag. If a flag is not provided, it defaults to 'r'.

path

A path to a file. If a URL is provided, it must use the file: protocol. If a FileHandle is provided, the underlying file will not be closed automatically.

@inline
def readFile(path: PathLike, options: BaseEncodingOptionsAborta): Promise[String | Buffer]
@inline
def readFile(path: PathLike, options: encodingBufferEncodingfla): Promise[String]

Asynchronously reads the entire contents of a file.

Asynchronously reads the entire contents of a file.

Value Params
options

An object that may contain an optional flag. If a flag is not provided, it defaults to 'r'.

path

A path to a file. If a URL is provided, it must use the file: protocol. If a FileHandle is provided, the underlying file will not be closed automatically.

@inline
def readFile(path: PathLike, options: encodingnullundefinedflag): Promise[Buffer]
@inline
def readFile(path: PathLike, options: BufferEncoding): Promise[String]
@inline
def readFile(path: FileHandle): Promise[Buffer]
@inline
def readFile(path: FileHandle, options: BaseEncodingOptionsAborta): Promise[String | Buffer]
@inline
def readFile(path: FileHandle, options: encodingBufferEncodingfla): Promise[String]
@inline
def readFile(path: FileHandle, options: encodingnullundefinedflag): Promise[Buffer]
@inline
def readFile(path: FileHandle, options: BufferEncoding): Promise[String]
@inline
def readdir(path: PathLike): Promise[Array[String]]

Asynchronous readdir(3) - read a directory.

Asynchronous readdir(3) - read a directory.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def readdir(path: PathLike, options: BaseEncodingOptionswithFi): Promise[Array[String]]
@inline
def readdir(path: PathLike, options: BaseEncodingOptionswithFiEncoding): Promise[Array[Dirent]]

Asynchronous readdir(3) - read a directory.

Asynchronous readdir(3) - read a directory.

Value Params
options

If called with withFileTypes: true the result data will be an array of Dirent.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def readdir(path: PathLike, options: Encoding): Promise[Array[Buffer]]

Asynchronous readdir(3) - read a directory.

Asynchronous readdir(3) - read a directory.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def readdir(path: PathLike, options: BufferEncoding): Promise[Array[String]]
@inline
def readdir_buffer(path: PathLike, options: buffer_): Promise[Array[Buffer]]
@inline
def realpath(path: PathLike): Promise[String]

Asynchronous realpath(3) - return the canonicalized absolute pathname.

Asynchronous realpath(3) - return the canonicalized absolute pathname.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def realpath(path: PathLike, options: BufferEncoding): Promise[String]
@inline
def realpath(path: PathLike, options: BaseEncodingOptions): Promise[String]
@inline
def realpath(path: PathLike, options: BufferEncodingOption): Promise[Buffer]

Asynchronous realpath(3) - return the canonicalized absolute pathname.

Asynchronous realpath(3) - return the canonicalized absolute pathname.

Value Params
options

The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def rename(oldPath: PathLike, newPath: PathLike): Promise[Unit]

Asynchronous rename(2) - Change the name or location of a file or directory.

Asynchronous rename(2) - Change the name or location of a file or directory.

Value Params
newPath

A path to a file. If a URL is provided, it must use the file: protocol. URL support is experimental.

oldPath

A path to a file. If a URL is provided, it must use the file: protocol. URL support is experimental.

@inline
def rm(path: PathLike): Promise[Unit]

Asynchronously removes files and directories (modeled on the standard POSIX rm utility).

Asynchronously removes files and directories (modeled on the standard POSIX rm utility).

@inline
def rm(path: PathLike, options: RmOptions): Promise[Unit]
@inline
def rmdir(path: PathLike): Promise[Unit]

Asynchronous rmdir(2) - delete a directory.

Asynchronous rmdir(2) - delete a directory.

Value Params
path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def rmdir(path: PathLike, options: RmDirOptions): Promise[Unit]
@inline
def stat(path: PathLike): Promise[Stats]

Asynchronous stat(2) - Get file status.

Asynchronous stat(2) - Get file status.

Value Params
path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def stat(path: PathLike, opts: StatOptionsbigintfalseund): Promise[Stats]
@inline
def stat(path: PathLike, opts: StatOptionsbiginttrue): Promise[BigIntStats]
@inline
def stat(path: PathLike, opts: StatOptions): Promise[Stats | BigIntStats]
@inline
def truncate(path: PathLike): Promise[Unit]

Asynchronous truncate(2) - Truncate a file to a specified length.

Asynchronous truncate(2) - Truncate a file to a specified length.

Value Params
len

If not specified, defaults to 0.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def truncate(path: PathLike, len: Double): Promise[Unit]
@inline
def utimes(path: PathLike, atime: String, mtime: String): Promise[Unit]

Asynchronously change file timestamps of the file referenced by the supplied path.

Asynchronously change file timestamps of the file referenced by the supplied path.

Value Params
atime

The last access time. If a string is provided, it will be coerced to number.

mtime

The last modified time. If a string is provided, it will be coerced to number.

path

A path to a file. If a URL is provided, it must use the file: protocol.

@inline
def utimes(path: PathLike, atime: String, mtime: Date): Promise[Unit]
@inline
def utimes(path: PathLike, atime: String, mtime: Double): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Date, mtime: String): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Date, mtime: Date): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Date, mtime: Double): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Double, mtime: String): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Double, mtime: Date): Promise[Unit]
@inline
def utimes(path: PathLike, atime: Double, mtime: Double): Promise[Unit]
@inline
def watch(filename: PathLike): AsyncIterable[String]

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Value Params
filename

A path to a file or directory. If a URL is provided, it must use the file: protocol.

options

Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. If encoding is not supplied, the default of 'utf8' is used. If persistent is not supplied, the default of true is used. If recursive is not supplied, the default of false is used.

@inline

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Value Params
filename

A path to a file or directory. If a URL is provided, it must use the file: protocol.

options

Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. If encoding is not supplied, the default of 'utf8' is used. If persistent is not supplied, the default of true is used. If recursive is not supplied, the default of false is used.

@inline
def watch(filename: PathLike, options: BufferEncoding): AsyncIterable[String]
@inline
def watch(filename: PathLike, options: WatchOptions): AsyncIterable[String]

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Watch for changes on filename, where filename is either a file or a directory, returning an FSWatcher.

Value Params
filename

A path to a file or directory. If a URL is provided, it must use the file: protocol.

options

Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. If encoding is not supplied, the default of 'utf8' is used. If persistent is not supplied, the default of true is used. If recursive is not supplied, the default of false is used.

@inline
def watch(filename: PathLike, options: String): AsyncIterable[Buffer | String]
@inline
def watch_buffer(filename: PathLike, options: buffer_): AsyncIterable[Buffer]
@inline
def write(handle: FileHandle, string: String): Promise[BufferBytesWritten]

Asynchronously writes string to the file referenced by the supplied FileHandle. It is unsafe to call fsPromises.write() multiple times on the same file without waiting for the Promise to be resolved (or rejected). For this scenario, fs.createWriteStream is strongly recommended.

Asynchronously writes string to the file referenced by the supplied FileHandle. It is unsafe to call fsPromises.write() multiple times on the same file without waiting for the Promise to be resolved (or rejected). For this scenario, fs.createWriteStream is strongly recommended.

Value Params
encoding

The expected string encoding.

handle

A FileHandle.

position

The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.

string

A string to write.

@inline
def write(handle: FileHandle, string: String, position: Double): Promise[BufferBytesWritten]
@inline
def write(handle: FileHandle, string: String, position: Double, encoding: BufferEncoding): Promise[BufferBytesWritten]
@inline
def write(handle: FileHandle, string: String, position: Null, encoding: BufferEncoding): Promise[BufferBytesWritten]
@inline
def write(handle: FileHandle, string: String, position: Unit, encoding: BufferEncoding): Promise[BufferBytesWritten]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer): Promise[BytesWritten[TBuffer]]

Asynchronously writes buffer to the file referenced by the supplied FileHandle. It is unsafe to call fsPromises.write() multiple times on the same file without waiting for the Promise to be resolved (or rejected). For this scenario, fs.createWriteStream is strongly recommended.

Asynchronously writes buffer to the file referenced by the supplied FileHandle. It is unsafe to call fsPromises.write() multiple times on the same file without waiting for the Promise to be resolved (or rejected). For this scenario, fs.createWriteStream is strongly recommended.

Value Params
buffer

The buffer that the data will be written to.

handle

A FileHandle.

length

The number of bytes to write. If not supplied, defaults to buffer.length - offset.

offset

The part of the buffer to be written. If not supplied, defaults to 0.

position

The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.

@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Double, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Null, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Double, length: Unit, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Double, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Null, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Null, length: Unit, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Double, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Null, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def write[TBuffer](handle: FileHandle, buffer: TBuffer, offset: Unit, length: Unit, position: Double): Promise[BytesWritten[TBuffer]]
@inline
def writeFile(path: PathLike, data: ArrayBufferView): Promise[Unit]
@inline
def writeFile(path: PathLike, data: ArrayBufferView, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: PathLike, data: ArrayBufferView, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Stream): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Stream, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Stream, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: PathLike, data: AsyncIterable[ArrayBufferView | String]): Promise[Unit]
@inline
def writeFile(path: PathLike, data: AsyncIterable[String | ArrayBufferView], options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: PathLike, data: AsyncIterable[String | ArrayBufferView], options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: PathLike, data: String): Promise[Unit]

Asynchronously writes data to a file, replacing the file if it already exists. It is unsafe to call fsPromises.writeFile() multiple times on the same file without waiting for the Promise to be resolved (or rejected).

Asynchronously writes data to a file, replacing the file if it already exists. It is unsafe to call fsPromises.writeFile() multiple times on the same file without waiting for the Promise to be resolved (or rejected).

Value Params
data

The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.

options

Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. If encoding is not supplied, the default of 'utf8' is used. If mode is not supplied, the default of 0o666 is used. If mode is a string, it is parsed as an octal integer. If flag is not supplied, the default of 'w' is used.

path

A path to a file. If a URL is provided, it must use the file: protocol. URL support is experimental. If a FileHandle is provided, the underlying file will not be closed automatically.

@inline
def writeFile(path: PathLike, data: String, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: PathLike, data: String, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Iterable[ArrayBufferView | String]): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Iterable[String | ArrayBufferView], options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: PathLike, data: Iterable[String | ArrayBufferView], options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: ArrayBufferView): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: ArrayBufferView, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: ArrayBufferView, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Stream): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Stream, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Stream, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: AsyncIterable[ArrayBufferView | String]): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: AsyncIterable[String | ArrayBufferView], options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: AsyncIterable[String | ArrayBufferView], options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: String): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: String, options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: String, options: BufferEncoding): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Iterable[ArrayBufferView | String]): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Iterable[String | ArrayBufferView], options: BaseEncodingOptionsmodeMo): Promise[Unit]
@inline
def writeFile(path: FileHandle, data: Iterable[String | ArrayBufferView], options: BufferEncoding): Promise[Unit]

Concrete fields

@JSImport("node:fs/promises") @native
val ^: Any