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

method File.writeBytesSync

Like writeBytes, and fsyncs the file before returning (durable).

Example:

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

fn main() io {
  let path = "/tmp/oxl_doc_wbs.bin"
  File.writeBytesSync(path, b"durable")!
  print("{File.readBytes(path)!.len()}")
  File.remove(path)!
}
Вывод
7
pub(api) static fn writeBytesSync(path: str, content: bytes) -> () | IoError  io

Сложность. O(n) plus the cost of the `fsync`.

С версии. 1.0.0-beta

Параметры

ИмяТип
pathstr
contentbytes

Возвращает

()

Ошибки

  • IoError @error
  • `IoError` as for `writeBytes`.

Эффекты

io

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

См. также