package tiny_httpd

  1. Overview
  2. Docs
type t = byte_stream
val close : t -> unit
val of_chan : in_channel -> t

Make a buffered stream from the given channel.

val of_chan_close_noerr : in_channel -> t

Same as of_chan but the close method will never fail.

val of_bytes : ?i:int -> ?len:int -> bytes -> t

A stream that just returns the slice of bytes starting from i and of length len.

val with_file : string -> (t -> 'a) -> 'a

Open a file with given name, and obtain an input stream on its content. When the function returns, the stream (and file) are closed.

val read_line : ?buf:Buf_.t -> t -> string

Read a line from the stream.

  • parameter buf

    a buffer to (re)use. Its content will be cleared.

val read_all : ?buf:Buf_.t -> t -> string

Read the whole stream into a string.

  • parameter buf

    a buffer to (re)use. Its content will be cleared.

OCaml

Innovation. Community. Security.