readUtf8

@JvmName(name = "readUtf8From")
fun File.readUtf8(): String(source)

Read the entire contents of a File (as UTF-8 text).

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

Return

The data as UTF-8 text.

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.