method File.readText
Whole file as UTF-8 text.
Example:
use std.io { File, fs }
fn main() io {
let dir = fs.tempDir()!
let p = "{dir}/a.txt"
File.writeText(p, "hello")!
print(File.readText(p)!)
fs.removeAll(dir)!
}Output
hello
pub(api) static fn readText(path: str) -> str | IoError ioSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
path | str |
Returns
str
Errors
IoError@error
Effects
io
Defined in: std/io/io.oxl:213