SplitScript reference / File / readAllText

File.readAllText

Function

File.readAllText(path: String) -> String!

Reads an entire UTF-8 text file.

This is the text counterpart to File.readAllBytes. The bytes must contain valid UTF-8; malformed text returns an error rather than being replaced lossily. The result preserves a UTF-8 BOM, line endings, and embedded NUL bytes exactly as text.

Parameters

  • path: Absolute path in the portable WASI namespace. The host filesystem is currently below /mnt: C:\Games\config.json maps to /mnt/c/Games/config.json, while /home/player/config.json maps to /mnt/home/player/config.json.

Effects: allocates, reads the filesystem

Runtime behavior: available everywhere; synchronous

Examples

Load configuration text

let configuration = File.readAllText("/mnt/home/player/game/configuration.json")?