writeFile

abstract suspend fun writeFile(data: String): Void(source)


abstract suspend fun writeFile(data: String, options: FileHandleWriteFileAsyncOptions? = definedExternally): Void(source)
abstract suspend fun writeFile(data: String, options: BufferEncoding? = definedExternally): Void(source)
abstract suspend fun writeFile(data: Uint8Array<*>): Void(source)
abstract suspend fun writeFile(data: Uint8Array<*>, options: FileHandleWriteFileAsyncOptions? = definedExternally): Void(source)
abstract suspend fun writeFile(data: Uint8Array<*>, options: BufferEncoding? = definedExternally): Void(source)

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.

If options is a string, then it specifies the encoding.

The FileHandle has to support writing.

It is unsafe to use filehandle.writeFile() multiple times on the same file without waiting for the promise to be fulfilled (or rejected).

If one or more filehandle.write() calls are made on a file handle and then afilehandle.writeFile() call is made, the data will be written from the current position till the end of the file. It doesn't always write from the beginning of the file.

Since

v10.0.0