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)!
}Вывод
hello
pub(api) static fn readText(path: str) -> str | IoError ioС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
path | str |
Возвращает
str
Ошибки
IoError@error
Эффекты
io
Определено в: std/io/io.oxl:207