Module File.Read

Reading files.

Read progress

type progress

The type for read progress.

val bytes_read : progress -> int

bytes_read p is the number of bytes read so far.

val bytes_total : progress -> int option

bytes_total p is the total number of bytes to read.

File reads

type error = [
| `Aborted
| `Security
| `Not_readable
| `Not_found
| `Other of string
]

The type for file read errors.

val pp_error : Stdlib.Format.formatter -> error -> unit

pp_error ppf e prints an unspecified representation of e on ppf.

type file = t

The type for files.

type 'a t

The type for file reads returning results of type 'a.

val to_data_url : file -> Jstr.t t

to_data_url f reads file f as as a data URL. This doesn't start the read use read.

val abort : 'a t -> unit

abort r aborts the file read r.

val result : 'a t -> (file * ('aerror) Stdlib.result) Note.event

result r is an event that occurs only once with the read result.

val progress : 'a t -> (file * progress) Note.event

progress r is an event that occurs during the read of r.