Read files with FileKit Core in Kotlin Multiplatform
PlatformFile
class offers multiple methods to read the contents of a file, from simple byte arrays to more complex streaming operations.
readBytes()
suspend function, which returns the file contents as a ByteArray
:
readString()
suspend function, which returns the file contents as a String
:
source()
method from kotlinx-io to get a raw source: