OxL Reference

method File.readBytes

Whole file as bytes.

Example:

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

fn main() io {
  let dir = fs.tempDir()!
  File.writeText("{dir}/b", "abc")!
  print("{File.readBytes("{dir}/b")!.len()}")
  fs.removeAll(dir)!
}
Output
3
pub(api) static fn readBytes(path: str) -> bytes | IoError  io

Since. 1.0.0-beta

Parameters

NameType
pathstr

Returns

bytes

Errors

Effects

io

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

See also