readFileBytes (Function)

Signature: readFileBytes(path: string, offset: int, count: int) -> Result<List<int>, Error>

Description: Reads at most count bytes from byte offset of a binary file as a List<int> of 0 to 255; NUL is an ordinary byte. The list is shorter only when the file ends first.

Parameters

  • path (string): Path to the file
  • offset (int): First byte to read
  • count (int): Most bytes to read

Returns: Result<List<int>, Error>

Example

match readFileBytes("model.gguf", 0, 4) {
    Success { value } => print("${listLength(value)} bytes")
    Error { message } => print(message)
}
match readFileBytes ("model.gguf", 0, 4)
    Success value => print "${listLength(value)} bytes"
    Error message => print message