FileHandle

sealed external interface FileHandle(source)

Properties

Link copied to clipboard
abstract val fd: Double

The numeric file descriptor managed by the {FileHandle} object.

Functions

Link copied to clipboard
abstract suspend fun appendFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun appendFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun appendFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: FileHandleAppendFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun appendFile(data: String, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun appendFile(data: String, options: FileHandleAppendFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void

Alias of filehandle.writeFile().

abstract suspend fun appendFile(data: String): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun appendFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun appendFileAsync(data: String): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun appendFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun appendFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: FileHandleAppendFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun appendFileAsync(data: String, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun appendFileAsync(data: String, options: FileHandleAppendFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Alias of filehandle.writeFile().

Link copied to clipboard
abstract suspend fun chmod(mode: Mode): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun chmodAsync(mode: Mode): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Modifies the permissions on the file. See chmod(2).

Link copied to clipboard
abstract suspend fun chown(uid: Number, gid: Number): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun chownAsync(uid: Number, gid: Number): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Changes the ownership of the file. A wrapper for chown(2).

Link copied to clipboard
abstract suspend fun close(): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun closeAsync(): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Closes the file handle after waiting for any pending operation on the handle to complete.

Link copied to clipboard
abstract fun createReadStream(options: CreateReadStreamOptions = definedExternally): ReadStream

Unlike the 16 KiB default highWaterMark for a stream.Readable, the stream returned by this method has a default highWaterMark of 64 KiB.

Link copied to clipboard
abstract fun createWriteStream(options: CreateWriteStreamOptions = definedExternally): WriteStream

options may also include a start option to allow writing data at some position past the beginning of the file, allowed values are in the \[0, Number.MAX_SAFE_INTEGER\] range. Modifying a file rather than replacing it may require the flags open option to be set to r+ rather than the default r. The encoding can be any one of those accepted by Buffer.

Link copied to clipboard
abstract suspend fun datasync(): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun datasyncAsync(): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Forces all currently queued I/O operations associated with the file to the operating system's synchronized I/O completion state. Refer to the POSIX fdatasync(2) documentation for details.

Link copied to clipboard
abstract suspend fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> read(options: FileReadOptions<T> = definedExternally): FileReadResult<T>
abstract suspend fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> read(buffer: T, options: FileReadOptions<T> = definedExternally): FileReadResult<T>
abstract suspend fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> read(buffer: T, offset: Double? = definedExternally, length: Double? = definedExternally, position: ReadPosition? = definedExternally): FileReadResult<T>
Link copied to clipboard
abstract fun readableWebStream(options: ReadableWebStreamOptions = definedExternally): ERROR CLASS: Symbol not found for ReadableStream<*>

Returns a byte-oriented ReadableStream that may be used to read the file's contents.

Link copied to clipboard
abstract fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> readAsync(options: FileReadOptions<T> = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileReadResult<T>>
abstract fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> readAsync(buffer: T, options: FileReadOptions<T> = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileReadResult<T>>

abstract fun <T : ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>> readAsync(buffer: T, offset: Double? = definedExternally, length: Double? = definedExternally, position: ReadPosition? = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileReadResult<T>>

Reads data from the file and stores that in the given buffer.

Link copied to clipboard
abstract suspend fun readFile(): Any
abstract suspend fun readFile(options: FileHandleReadFileBufferAsyncOptions? = definedExternally): Buffer<*>
abstract suspend fun readFile(options: FileHandleReadFileStringAsyncOptions): String

abstract suspend fun readFile(options: BufferEncoding): String
abstract suspend fun readFile(options: BufferEncoding? = definedExternally): Any
abstract suspend fun readFile(options: FileHandleReadFileAsyncOptions? = definedExternally): Any

Asynchronously reads the entire contents of a file. The underlying file will not be closed automatically. The FileHandle must have been opened for reading.

Link copied to clipboard
abstract fun readFileAsync(): ERROR CLASS: Symbol not found for Promise<kotlin/Any>
abstract fun readFileAsync(options: BufferEncoding): ERROR CLASS: Symbol not found for Promise<kotlin/String>
abstract fun readFileAsync(options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<kotlin/Any>
abstract fun readFileAsync(options: FileHandleReadFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<kotlin/Any>
abstract fun readFileAsync(options: FileHandleReadFileStringAsyncOptions): ERROR CLASS: Symbol not found for Promise<kotlin/String>

Asynchronously reads the entire contents of a file. The underlying file will not be closed automatically. The FileHandle must have been opened for reading.

abstract fun readFileAsync(options: FileHandleReadFileBufferAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<node/buffer/Buffer<*>>

Asynchronously reads the entire contents of a file.

Link copied to clipboard
abstract fun readLines(options: CreateReadStreamOptions = definedExternally): _Interface

Convenience method to create a readline interface and stream over the file. See filehandle.createReadStream() for the options.

Link copied to clipboard
abstract suspend fun readv(buffers: ERROR CLASS: Symbol not found for ReadonlyArray<ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>>, position: Number = definedExternally): ReadVResult
Link copied to clipboard
abstract fun readvAsync(buffers: ERROR CLASS: Symbol not found for ReadonlyArray<ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>>, position: Number = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/ReadVResult>

Read from a file and write to an array of ArrayBufferView s

Link copied to clipboard
abstract suspend fun stat(opts: FileHandleStatBigIntOpts): BigIntStats
abstract suspend fun stat(opts: FileHandleStatOpts = definedExternally): Stats
abstract suspend fun stat(opts: StatOptions = definedExternally): Any
Link copied to clipboard
abstract fun statAsync(opts: FileHandleStatBigIntOpts): ERROR CLASS: Symbol not found for Promise<node/fs/BigIntStats>
abstract fun statAsync(opts: FileHandleStatOpts = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/Stats>
abstract fun statAsync(opts: StatOptions = definedExternally): ERROR CLASS: Symbol not found for Promise<kotlin/Any>
Link copied to clipboard
abstract suspend fun sync(): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun syncAsync(): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Request that all data for the open file descriptor is flushed to the storage device. The specific implementation is operating system and device specific. Refer to the POSIX fsync(2) documentation for more detail.

Link copied to clipboard
abstract suspend fun truncate(len: Number = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun truncateAsync(len: Number = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Truncates the file.

Link copied to clipboard
abstract suspend fun utimes(atime: TimeLike, mtime: TimeLike): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun utimesAsync(atime: TimeLike, mtime: TimeLike): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Change the file system timestamps of the object referenced by the FileHandle then fulfills the promise with no arguments upon success.

Link copied to clipboard
abstract suspend fun <TBuffer : ERROR CLASS: Symbol not found for Uint8Array<*>> write(buffer: TBuffer, options: FileHandleWriteAsyncOptions = definedExternally): FileHandleWriteResultPayload<TBuffer>
abstract suspend fun write(data: String, position: Double? = definedExternally, encoding: BufferEncoding? = definedExternally): FileHandleWriteStringResultPayload
abstract suspend fun <TBuffer : ERROR CLASS: Symbol not found for Uint8Array<*>> write(buffer: TBuffer, offset: Double? = definedExternally, length: Double? = definedExternally, position: Double? = definedExternally): FileHandleWriteResultPayload<TBuffer>
Link copied to clipboard
abstract fun <TBuffer : ERROR CLASS: Symbol not found for Uint8Array<*>> writeAsync(buffer: TBuffer, options: FileHandleWriteAsyncOptions = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileHandleWriteResultPayload<TBuffer>>
abstract fun writeAsync(data: String, position: Double? = definedExternally, encoding: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileHandleWriteStringResultPayload>

abstract fun <TBuffer : ERROR CLASS: Symbol not found for Uint8Array<*>> writeAsync(buffer: TBuffer, offset: Double? = definedExternally, length: Double? = definedExternally, position: Double? = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/FileHandleWriteResultPayload<TBuffer>>

Write buffer to the file.

Link copied to clipboard
abstract suspend fun writeFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun writeFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun writeFile(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: FileHandleWriteFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun writeFile(data: String, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void
abstract suspend fun writeFile(data: String, options: FileHandleWriteFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for js.core.Void

Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object. The promise is fulfilled with no arguments upon success.

abstract suspend fun writeFile(data: String): ERROR CLASS: Symbol not found for js.core.Void
Link copied to clipboard
abstract fun writeFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun writeFileAsync(data: String): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun writeFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun writeFileAsync(data: ERROR CLASS: Symbol not found for Uint8Array<*>, options: FileHandleWriteFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun writeFileAsync(data: String, options: BufferEncoding? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>
abstract fun writeFileAsync(data: String, options: FileHandleWriteFileAsyncOptions? = definedExternally): ERROR CLASS: Symbol not found for Promise<ERROR CLASS: Symbol not found for js.core.Void>

Asynchronously writes data to a file, replacing the file if it already exists. data can be a string, a buffer, an AsyncIterable, or an Iterable object. The promise is fulfilled with no arguments upon success.

Link copied to clipboard
abstract suspend fun writev(buffers: ERROR CLASS: Symbol not found for ReadonlyArray<ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>>, position: Number = definedExternally): WriteVResult
Link copied to clipboard
abstract fun writevAsync(buffers: ERROR CLASS: Symbol not found for ReadonlyArray<ERROR CLASS: Symbol not found for js.buffer.ArrayBufferView<*>>, position: Number = definedExternally): ERROR CLASS: Symbol not found for Promise<node/fs/WriteVResult>

Write an array of ArrayBufferView s to the file.