Module Os.Fd
File descriptors operations.
val unix_buffer_size : int
unix_buffer_size
is the value of the OCaml runtime system buffer size for I/O operations.
val apply : close:(Unix.file_descr -> unit) -> Unix.file_descr -> (Unix.file_descr -> 'a) -> 'a
apply ~close fd f
callsf fd
and ensureclose fd
is is called whenever the function returns. AnyUnix.Unix_error
raised byclose fd
is ignored.
val copy : ?buf:Stdlib.Bytes.t -> src:Unix.file_descr -> Unix.file_descr -> unit
copy ~buf ~src dst
readssrc
and writes it todst
usingbuf
as a buffer; if unspecified a buffer of lengthunix_buffer_size
is created for the call.- raises Unix_error
if that happens
val to_string : Unix.file_descr -> string
to_string fd
readsfd
to a string.- raises Unix_error
in case of error.
val read_file : string -> Unix.file_descr -> string
read_file fn fd
readsfd
to a string assuming it is a file descriptor open on file pathfn
.- raises Failure
in case of error with an error message that mentions
fn
.