Parameter Atomic_write_ext.IO

File-system abstractions

type path = string

The type for paths.

Read operations

val rec_files : path -> string list Lwt.t

rec_files dir is the list of files recursively present in dir and all of its sub-directories. Return filenames prefixed by dir.

val file_exists : path -> bool Lwt.t

file_exist f is true if f exists.

val read_file : path -> string option Lwt.t

Read the contents of a file using mmap.

Write Operations

val mkdir : path -> unit Lwt.t

Create a directory.

type lock

The type for file locks.

val lock_file : path -> lock

lock_file f is the lock associated to the file f.

val write_file : ?temp_dir:path -> ?lock:lock -> path -> string -> unit Lwt.t

Atomic writes.

val test_and_set_file : ?temp_dir:string -> lock:lock -> path -> test:string option -> set:string option -> bool Lwt.t

Test and set.

val remove_file : ?lock:lock -> path -> unit Lwt.t

Remove a file or directory (even if non-empty).