readBytes

suspend fun File.readBytes(): ByteArray(source)

Read the contents of a file as a ByteArray, suspending until the read is complete.

Throws

if the file could not be read.


fun File.readBytes(onError: () -> Unit = {}, onLoad: (ByteArray) -> Unit)(source)

Read the contents of a file as a ByteArray, asynchronously.