-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathfiles.mli
More file actions
32 lines (24 loc) · 1.39 KB
/
files.mli
File metadata and controls
32 lines (24 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(** File system *)
val enum_dir : Unix.dir_handle -> string Enum.t
val with_readdir : string -> (Unix.dir_handle -> 'a) -> 'a
(** [f fd path rel] gets invoked for each file under [dirname] where
[fd] is a read-only [Unix.file_descr], [path] is full path and [rel] - path relative to [dirname] *)
val iter_names : string -> (Unix.file_descr -> string -> string -> unit) -> unit
(** [iter_names_q dirname (fun [path] [rel] -> ...)] *)
val iter_names_q : string -> (string -> string -> unit) -> unit
(** [iter_files dirname (fun [path] [ic] -> ...)] *)
val iter_files : string -> (string -> in_channel -> unit) -> unit
val open_out_append_bin : string -> out_channel
val open_out_append_text : string -> out_channel
(** [mkdir_p ?perm path] creates directory [path] and all missing parent
directories. Similar to [mkdir -p]. Raises [Failure] if [path] exists
but is not a directory. Default [perm] is [0o755]. *)
val mkdir_p : ?perm:Unix.file_perm -> string -> unit
(** [save_as filename ?mode f] is similar to
[Control.with_open_file_bin] except that writing is done to a
temporary file that will be renamed to [filename] after [f] has
succesfully terminated. Therefore this guarantee that either
[filename] will not be modified or will contain whatever [f] was
writing to it as a side-effect.
FIXME windows *)
val save_as : string -> ?mode:Unix.file_perm -> (out_channel -> unit) -> unit