writeBytes

fun writeBytes(path: String, bytes: ByteArray)(source)

Writes bytes to the file at path, creating the file or replacing its contents. A directory on the way to the file that does not exist yet is created first, parents included.

A relative path resolves against basePath; an absolute one is used as given. bytes is only read during the call and never retained.

Has no sample because it writes a file to disk.

Throws

if the file cannot be created or written, for example because a part of its path is a file rather than a directory.