method File.copy
Copies a file; an existing destination is replaced only with overwrite: true.
Example:
use std.io { File, fs }
fn main() io {
let dir = fs.tempDir()!
File.writeText("{dir}/a", "data")!
File.copy("{dir}/a", "{dir}/b")!
print(File.readText("{dir}/b")!)
fs.removeAll(dir)!
}Вывод
data
pub(api) static fn copy(from: str, to: str, overwrite: bool = false) -> () | IoError ioС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
from | str |
to | str |
overwrite | bool = false |
Возвращает
()
Ошибки
IoError@error
Эффекты
io
Определено в: std/io/io.oxl:415