Asynchronously append data to a file, creating the file if it does not exist. The underlying file will not be closed automatically.
The FileHandle
must have been opened for appending.
The data to write. If something other than a Buffer
or Uint8Array
is provided, the value is coerced to a string.
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.
Asynchronous fchmod(2) - Change permissions of a file.
A file mode. If a string is passed, it is parsed as an octal integer.
Asynchronous fchown(2) - Change ownership of a file.
Asynchronous close(2) - close a FileHandle
.
Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
Asynchronously reads data from the file.
The FileHandle
must have been opened for reading.
The buffer that the data will be written to.
The offset in the buffer at which to start writing.
The number of bytes to read.
The offset from the beginning of the file from which data should be read. If null
, data will be read from the current position.
Asynchronously reads the entire contents of a file. The underlying file will not be closed automatically.
The FileHandle
must have been opened for reading.
An object that may contain an optional flag.
If a flag is not provided, it defaults to 'r'
.
Asynchronously reads the entire contents of a file. The underlying file will not be closed automatically.
The FileHandle
must have been opened for reading.
An object that may contain an optional flag.
If a flag is not provided, it defaults to 'r'
.
Asynchronously reads the entire contents of a file. The underlying file will not be closed automatically.
The FileHandle
must have been opened for reading.
An object that may contain an optional flag.
If a flag is not provided, it defaults to 'r'
.
See fs.readv
promisified version.
Asynchronous fstat(2) - Get file status.
Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
Asynchronous ftruncate(2) - Truncate a file to a specified length.
If not specified, defaults to 0
.
Asynchronously change file timestamps of the file.
The last access time. If a string is provided, it will be coerced to number.
The last modified time. If a string is provided, it will be coerced to number.
Asynchronously writes buffer
to the file.
The FileHandle
must have been opened for writing.
The buffer that the data will be written to.
The part of the buffer to be written. If not supplied, defaults to 0
.
The number of bytes to write. If not supplied, defaults to buffer.length - offset
.
The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Asynchronously writes string
to the file.
The FileHandle
must have been opened for writing.
It is unsafe to call 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.
The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
The expected string encoding.
Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will not be closed automatically.
The FileHandle
must have been opened for writing.
It is unsafe to call writeFile()
multiple times on the same file without waiting for the Promise
to be resolved (or rejected).
The data to write. If something other than a Buffer
or Uint8Array
is provided, the value is coerced to a string.
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.
See fs.writev
promisified version.
Generated using TypeDoc
Gets the file descriptor for this file handle.