OxL Reference

method File.appendText

Appends text, creating the file if needed.

Example:

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

fn main() io {
  let dir = fs.tempDir()!
  File.appendText("{dir}/log", "a")!
  File.appendText("{dir}/log", "b")!
  print(File.readText("{dir}/log")!)
  fs.removeAll(dir)!
}
Output
ab
pub(api) static fn appendText(path: str, text: str) -> () | IoError  io

Since. 1.0.0-beta

Parameters

NameType
pathstr
textstr

Returns

()

Errors

Effects

io

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

See also