package containers

  1. Overview
  2. Docs
type t = string

A file is always represented by its absolute path

val to_string : t -> string
val make : string -> t

Build a file representation from a path (absolute or relative)

val exists : t -> bool io
val is_directory : t -> bool io
val remove : t -> unit io
val read_dir : ?recurse:bool -> t -> t Seq.t io

read_dir d returns a sequence of files and directory contained in the directory d (or an empty stream if d is not a directory)

  • parameter recurse

    if true (default false), sub-directories are also explored

val walk : t -> ([ `File | `Dir ] * t) Seq.t io

similar to read_dir (with recurse=true), this function walks a directory recursively and yields either files or directories. Is a file anything that doesn't satisfy is_directory (including symlinks, etc.)

OCaml

Innovation. Community. Security.