writeBytes

open suspend override fun writeBytes(path: Path, data: ByteArray)(source)

Writes content to a file. If the file doesn't exist, it will be created. If the file exists, its content will be overwritten. Parent directories will be created if they don't exist. The operation is performed with Dispatchers.IO context.

Parameters

path

The path to write to.

data

The data to write as a byte array.

Throws

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