readBytes

@JvmName(name = "readBytesFrom")
fun File.readBytes(): ByteArray(source)

Read the entire contents of a File (as bytes).

NOTE: This function is not recommended for large files. There is an internal limitation of 2GB file size.

Return

The data as an array.

See also

Throws

If there was a failure to read the File, such as its non-existence, not being a regular file, being too large, or the filesystem threw a security exception.

UnsupportedOperationException

On Kotlin/JS-Browser.