Module B0_std.Os.Fd

module Fd: sig .. end

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 calls f fd and ensure close fd is is called whenever the function returns. Any Unix.Unix_error raised by close fd is ignored.

val copy : ?buf:Stdlib.Bytes.t -> src:Unix.file_descr -> Unix.file_descr -> unit

copy ~buf ~src dst reads src and writes it to dst using buf as a buffer; if unspecified a buffer of length B0_std.Os.Fd.unix_buffer_size is created for the call.

val to_string : Unix.file_descr -> string

to_string fd reads fd to a string.

val read_file : string -> Unix.file_descr -> string

read_file fn fd reads fd to a string assuming it is a file descriptor open on file path fn.