write
expect inline fun <T> write(file: Path, mustCreate: Boolean = false, writerAction: BufferedSink.() -> T): T
Creates a sink to write file, executes writerAction to write it, and then closes the sink. This is a compact way to write a file.
Parameters
must Create
true to throw an IOException instead of overwriting an existing file. This is equivalent to O_EXCL
on POSIX and CREATE_NEW
on Windows.