OxL Reference

method File.appendBytes

Appends content, creating the file if needed.

Example:

oxl✓ checked in CI
use std.io { File }

fn main() io {
  let path = "/tmp/oxl_doc_ab.bin"
  File.writeBytes(path, b"ab")!
  File.appendBytes(path, b"cd")!
  print("{File.readBytes(path)!.len()}")
  File.remove(path)!
}
Output
4
pub(api) static fn appendBytes(path: str, content: bytes) -> () | IoError  io

Complexity. O(n) in the size of the content.

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:364

See also