Module Down_std.File

Files.

val null : string

null is an empty file that discards all writes.

val exists : string -> (bool, string) Stdlib.result

exists file checks for file (or directory) existence.

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

delete file deletes file file.

val rename : string -> dst:string -> (unit, string) Stdlib.result

rename src ~dst renames src into dst.

val read : string -> (string, string) Stdlib.result

read file is the contents of file file.

val write : file:string -> string -> (unit, string) Stdlib.result

write file d writes d to file.

val set_content : file:string -> string -> (unit, string) Stdlib.result

set_content ~file s sets the contents of file file to s. The path to the file is created if it doesn't exist.

val tmp : ?⁠suff:string -> unit -> (string, string) Stdlib.result

tmp () is a temporary file whose name ends with suff.