Companion

Functions

Link copied to clipboard

Reads the file at path. Throws if it cannot be read, as in browsers, which have no file system; use fromString there.

Link copied to clipboard
fun fromResource(path: String, optional: Boolean = false): TomlSource

Reads a bundled file (see readResourceText for each platform); optional allows it to be missing.

Link copied to clipboard
fun fromString(content: String, origin: String? = null): TomlSource

Parses TOML text that is already in memory. Blank text gives an empty source, and invalid TOML throws ktoml's parse exception. origin, such as the file name, labels the source in ConfigLoader.explain reports.