bonsai

A library for building dynamic webapps, using Js_of_ocaml
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library bonsai.web_ui_file
type t
val create_static : filename:string -> contents:string -> t

Create a t with the given contents

val create_stream : filename:string -> total_bytes:int -> t

Create a t that can be fed bytes continually using feed_exn.

total_bytes will be fed through to the Progress value in any reads. Note that we do nothing smart to close t when you have fed at least total_bytes bytes to t.

val feed_exn : t -> string -> unit

If t was created using create_stream, you can feed it more bytes. Raises if t was created using create_static, or if close or close_error have been called.

val close : t -> unit

Mark t as closed so that any file reads based on t will be marked complete. close is idempotent and does nothing if t was created using create_static.

val close_error : t -> Core.Error.t -> unit

Close t with an error to emulate an error when reading from the file. Does nothing if close has already been called or t was created using create_static.

val read_status : t -> [ `Aborted | `Not_reading | `Reading ]

Describes whether a read is currently ongoing for the stream in question.