package tiny_httpd

  1. Overview
  2. Docs

Module Tiny_httpd_io.WriterSource

A writer abstraction.

Sourcetype t = {
  1. write : Output.t -> unit;
}

Writer.

A writer is a push-based stream of bytes. Give it an output channel and it will write the bytes in it.

This is useful for responses: an http endpoint can return a writer as its response's body, and output into it as if it were a regular out_channel, including controlling calls to flush.

  • since 0.14
Sourceval make : write:(Output.t -> unit) -> unit -> t
Sourceval write : Output.t -> t -> unit

Write into the channel.

Sourceval empty : t

Empty writer, will output 0 bytes.

Sourceval of_string : string -> t

A writer that just emits the bytes from the given string.

OCaml

Innovation. Community. Security.