diff --git a/dev/containers/CCIO/index.html b/dev/containers/CCIO/index.html index 3b5a2f4b..53fa123d 100644 --- a/dev/containers/CCIO/index.html +++ b/dev/containers/CCIO/index.html @@ -17,6 +17,6 @@ (fun oc -> write_gen oc chunks ) - ) ;;
was in 'containers.io', now moved into 'containers'
type 'a or_error = ('a, string) Stdlib.resulttype 'a gen = unit -> 'a optionSee Gen in the gen library.
val with_in : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.in_channel -> 'a) -> 'aOpen an input file with the given optional flag list, calls the function on the input channel. When the function raises or returns, the channel is closed.
in case of error (same as open_in and close_in).
opening flags (default [Open_text]). Open_rdonly is used in any cases.
val read_chunks_gen : ?size:int -> Stdlib.in_channel -> string genRead the channel's content into chunks of size size. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.
val read_line : Stdlib.in_channel -> string optionRead a line from the channel. Returns None if the input is terminated. The "\n" is removed from the line.
val read_lines_gen : Stdlib.in_channel -> string genRead all lines. The generator should be traversed only once. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.
val read_lines_l : Stdlib.in_channel -> string listRead all lines into a list.
val read_all : ?size:int -> Stdlib.in_channel -> stringRead the whole channel into a buffer, then converted into a string.
the internal buffer size.
val read_all_bytes : ?size:int -> Stdlib.in_channel -> Stdlib.Bytes.tRead the whole channel into a mutable byte array.
the internal buffer size.
val with_out : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.out_channel -> 'a) -> 'aLike with_in but for an output channel.
opening flags (default [Open_creat; Open_trunc; Open_text]).
in case of error (same as open_out and close_out). Open_wronly is used in any cases.
val with_out_a : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.out_channel -> 'a) -> 'aLike with_out but with the [Open_append; Open_creat; Open_wronly] flags activated, to append to the file.
in case of error (same as open_out and close_out).
val write_line : Stdlib.out_channel -> string -> unitWrite the given string on the channel, followed by "\n".
val write_gen : ?sep:string -> Stdlib.out_channel -> string gen -> unitWrite the given strings on the output. If provided, add sep between every two strings (but not at the end).
val write_lines : Stdlib.out_channel -> string gen -> unitWrite every string on the output, followed by "\n".
val write_lines_l : Stdlib.out_channel -> string list -> unitval with_in_out : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.in_channel -> Stdlib.out_channel -> 'a) -> 'aCombines with_in and with_out.
opening flags (default [Open_creat]).
in case of error.
val copy_into : ?bufsize:int -> Stdlib.in_channel -> Stdlib.out_channel -> unitcopy_into ic oc writes the content of ic into oc. It is a blocking call.
val tee : ('a -> unit) list -> 'a gen -> 'a gentee funs gen behaves like gen, but each element is given to every function f in funs at the time the element is produced. The returned generator will raise any exception that f raises
How to list recursively files in a directory:
# let files = CCIO.File.read_dir ~recurse:true (CCIO.File.make "/tmp");;
+ ) ;;was in 'containers.io', now moved into 'containers'
type 'a or_error = ('a, string) Stdlib.resulttype 'a gen = unit -> 'a optionSee Gen in the gen library.
val with_in : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.in_channel -> 'a) -> 'aOpen an input file with the given optional flag list, calls the function on the input channel. When the function raises or returns, the channel is closed.
in case of error (same as open_in and close_in).
opening flags (default [Open_text]). Open_rdonly is used in any cases.
val read_chunks_gen : ?size:int -> Stdlib.in_channel -> string genRead the channel's content into chunks of size size. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.
val read_chunks_seq : ?size:int -> Stdlib.in_channel -> string Stdlib.Seq.tRead the channel's content into chunks of size size. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.
val read_line : Stdlib.in_channel -> string optionRead a line from the channel. Returns None if the input is terminated. The "\n" is removed from the line.
val read_lines_gen : Stdlib.in_channel -> string genRead all lines. The generator should be traversed only once. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.
val read_lines_seq : Stdlib.in_channel -> string Stdlib.Seq.tRead all lines. NOTE the seq must be used within the lifetime of the channel, see warning at the top of the file.
val read_lines_l : Stdlib.in_channel -> string listRead all lines into a list.
val read_all : ?size:int -> Stdlib.in_channel -> stringRead the whole channel into a buffer, then converted into a string.
the internal buffer size.
val read_all_bytes : ?size:int -> Stdlib.in_channel -> Stdlib.Bytes.tRead the whole channel into a mutable byte array.
the internal buffer size.
val with_out : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.out_channel -> 'a) -> 'aLike with_in but for an output channel.
opening flags (default [Open_creat; Open_trunc; Open_text]).
in case of error (same as open_out and close_out). Open_wronly is used in any cases.
val with_out_a : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.out_channel -> 'a) -> 'aLike with_out but with the [Open_append; Open_creat; Open_wronly] flags activated, to append to the file.
in case of error (same as open_out and close_out).
val write_line : Stdlib.out_channel -> string -> unitWrite the given string on the channel, followed by "\n".
val write_gen : ?sep:string -> Stdlib.out_channel -> string gen -> unitWrite the given strings on the output. If provided, add sep between every two strings (but not at the end).
val write_seq : ?sep:string -> Stdlib.out_channel -> string Stdlib.Seq.t -> unitWrite the given strings on the output. If provided, add sep between every two strings (but not at the end).
val write_lines : Stdlib.out_channel -> string gen -> unitWrite every string on the output, followed by "\n".
val write_lines_seq : Stdlib.out_channel -> string Stdlib.Seq.t -> unitWrite every string on the output, followed by "\n".
val write_lines_l : Stdlib.out_channel -> string list -> unitval with_in_out : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> (Stdlib.in_channel -> Stdlib.out_channel -> 'a) -> 'aCombines with_in and with_out.
opening flags (default [Open_creat]).
in case of error.
val copy_into : ?bufsize:int -> Stdlib.in_channel -> Stdlib.out_channel -> unitcopy_into ic oc writes the content of ic into oc. It is a blocking call.
val tee : ('a -> unit) list -> 'a gen -> 'a gentee funs gen behaves like gen, but each element is given to every function f in funs at the time the element is produced. The returned generator will raise any exception that f raises
How to list recursively files in a directory:
# let files = CCIO.File.read_dir ~recurse:true (CCIO.File.make "/tmp");;
# CCIO.write_lines stdout files;;See File.walk if you also need to list directories:
# let content = CCIO.File.walk (CCIO.File.make "/tmp");;
# Gen.map CCIO.File.show_walk_item content |> CCIO.write_lines stdout;;module File : sig ... end