outputStream

abstract suspend fun outputStream(path: Path, append: Boolean = false): Sink(source)

Creates a Sink for writing to a file. If the file doesn't exist, it will be created. If the parent directories don't exist, they will be created. The returned Sink is buffered.

Return

A buffered Sink object for writing.

Parameters

path

The path where Sink will be created.

append

Append to existing content (true) or overwrite (false). Default is false (overwrite).

Throws

IOException

if the path is a directory or any other I/O error occurs during Sink creation.