Function in io::file coil-stdlib

read_bytes

fn read_bytes(string path) -> Result<Vec<byte>, IoError>
Import
use io::file::{read_bytes};
Source: src/io/file.hy

Reads the whole file at path.

Needs --allow-read.

Parameters#

NameType
pathstring

Returns#

Result<Vec<byte>, IoError>

Errors#

IoError::NotFound when the file does not exist, PermissionDenied when it cannot be opened.

See also#

  • write_bytes: Replaces the contents of the file at path with buf, creating it if needed, and returns the number of bytes written.
  • read_text: Reads the whole file at path as UTF-8 text.
  • write_text: Replaces the contents of the file at path with text, creating it if needed, and returns the number of bytes written.
  • append_bytes: Appends buf to the file at path, creating it if needed.
  • append_text: Appends text to the file at path, creating it if needed.
↑ ↓ navigate ↵ open