Module Bi_stream

Streaming utilities (experimental)

val read_stream : (string -> 'a array) -> Stdlib.in_channel -> 'a Stdlib.Stream.t

read_stream of_string ic creates an OCaml stream from an input channel ic. The data come in chunks and each chunk is converted from a string to an array by calling of_string.

val write_stream : ?⁠chunk_len:int -> ('a array -> string) -> Stdlib.out_channel -> 'a Stdlib.Stream.t -> unit

write_stream to_string oc st writes an OCaml stream to the output channel oc. It creates chunks of chunk_len, except for the last chunk which is usually smaller.

parameter chunk_len

has a default value of 1024. The limit supported by this OCaml implementation on 32-bit platforms is 16777215.