Module Operator.Reader

Reader Operations

Module for reading data from files with fine-grained control.

val pread : Opendal_core.Operator.reader -> bytes -> int64 -> (int, string) Stdlib.result

pread reader buf offset reads data from the reader at the given offset.

  • parameter reader

    The reader instance

  • parameter buf

    Buffer to read data into

  • parameter offset

    Byte offset in the file to start reading from

  • returns

    Number of bytes actually read

Example:

let buf = Bytes.create 1024 in
match Reader.pread reader buf 100L with
| Ok bytes_read ->
    printf "Read %d bytes starting at offset 100\n" bytes_read
| Error err -> printf "Error: %s\n" err