package stdune

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

IO operations.

val close_in : Stdlib.in_channel -> unit
val close_out : Stdlib.out_channel -> unit
val close_both : (Stdlib.in_channel * Stdlib.out_channel) -> unit
val input_lines : Stdlib.in_channel -> string list
val copy_channels : Stdlib.in_channel -> Stdlib.out_channel -> unit

This function is not safe to use from multiple threads, even if operating on unrelated channels because it uses a statically-allocated global buffer.

val read_all_unless_large : Stdlib.in_channel -> (string, unit) Stdlib.result

Try to read everything from a channel. Returns Error () if the contents are larger than Sys.max_string_length. This is generally a problem only on 32-bit systems. Overflow detection does not happen in the following cases:

  • channel is not a file (for example, a pipe)
  • if the detected size is unreliable (/proc)
  • race condition with another process changing the size of the underlying file. In these cases, an exception might be raised by Buffer functions.
type path = Path.t
val open_in : ?binary:bool -> path -> Stdlib.in_channel
val open_out : ?binary:bool -> ?perm:int -> path -> Stdlib.out_channel
val with_file_in : ?binary:bool -> path -> f:(Stdlib.in_channel -> 'a) -> 'a
val with_file_out : ?binary:bool -> ?perm:int -> path -> f:(Stdlib.out_channel -> 'a) -> 'a
val with_lexbuf_from_file : path -> f:(Stdlib.Lexing.lexbuf -> 'a) -> 'a
val lines_of_file : path -> string list
val zero_strings_of_file : path -> string list

Reads zero-separated strings from a file

val read_file : ?binary:bool -> path -> string
val write_file : ?binary:bool -> ?perm:int -> path -> string -> unit
val compare_files : path -> path -> Ordering.t
val compare_text_files : path -> path -> Ordering.t
val write_lines : ?binary:bool -> ?perm:int -> path -> string list -> unit
val copy_file : ?chmod:(int -> int) -> src:path -> dst:path -> unit -> unit
val setup_copy : ?chmod:(int -> int) -> src:path -> dst:path -> unit -> Stdlib.in_channel * Stdlib.out_channel
val file_line : path -> int -> string
val file_lines : path -> start:int -> stop:int -> (string * string) list
val cat : ?binary:bool -> ?dst:Stdlib.out_channel -> path -> unit

reads a file and prints its contents to stdout or the specified channel

module String_path : sig ... end

Symlink with fallback to copy on systems that don't support it.

Hardlink with fallback to copy on systems that don't support it.

val set_copy_impl : [ `Portable | `Best ] -> unit
OCaml

Innovation. Community. Security.