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

method File.writeBytes

Creates or truncates the file and writes content.

Example:

oxl✓ проверяется в CI
use std.io { File }

fn main() io {
  let path = "/tmp/oxl_doc_wb.bin"
  File.writeBytes(path, b"\x00\x01\x02")!
  print("{File.readBytes(path)!.len()}")
  File.remove(path)!
}
Вывод
3
pub(api) static fn writeBytes(path: str, content: bytes) -> () | IoError  io

Сложность. O(n) in the size of the content.

С версии. 1.0.0-beta

Параметры

ИмяТип
pathstr
contentbytes

Возвращает

()

Ошибки

  • IoError @error
  • `IoError` (`NotFound` for a missing directory, `PermissionDenied`, ...).

Эффекты

io

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

См. также