OxL Справочник OxL
РусскийEnglish

method File.copy

Copies a file; an existing destination is replaced only with overwrite: true.

Example:

oxl✓ проверяется в CI
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

Параметры

ИмяТип
fromstr
tostr
overwritebool = false

Возвращает

()

Ошибки

Эффекты

io

Определено в: std/io/io.oxl:415

См. также