IO.Writer
A writer abstraction.
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; the writer is given access to the connection to the client and can write into it as if it were a regular out_channel
, including controlling calls to flush
. Tiny_httpd will convert these writes into valid HTTP chunks.
val empty : t
Empty writer, will output 0 bytes.
val of_string : string -> t
A writer that just emits the bytes from the given string.