OxL Reference

method File.writeBytesSync

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

Example:

oxl✓ checked in 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)!
}
Output
7
pub(api) static fn writeBytesSync(path: str, content: bytes) -> () | IoError  io

Complexity. O(n) plus the cost of the `fsync`.

Since. 1.0.0-beta

Parameters

NameType
pathstr
contentbytes

Returns

()

Errors

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

Effects

io

Defined in: std/io/io.oxl:317

See also