Reference
Files
Read a bounded UTF-8 file from Kotlin/Native.
Usage context
| Module | Package | SDK source |
|---|---|---|
| Kotlin/Native | nimby | kotlin/src/nimby/Files.kt |
Public API for SDK 0.9.0-alpha.2. Each entry provides the Kotlin signature and its contract: what the value means, conditions of use and effects to understand. Choose imports from the module shown above.
Imports on this page
import nimby.readTextFileRead a file
kotlin
val contenu = nimby.readTextFile("config/options.json")The path is resolved from the working directory. Reading is limited to 4,194,304 bytes and closes the file even on error. The SDK does not automatically parse JSON or save the file for you.
readTextFile
nimby · fun
fun readTextFile(path: String): StringReads and closes a local UTF-8 file, up to 4 MiB. An empty file returns an empty string. Opening, size and reading errors throw; this helper does not automatically search the package.