package bonsai
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=24c4c3149280abd639034ce3acf60e475a772202099e965be8bd8902524573ef
doc/bonsai.web_ui_file/Bonsai_web_ui_file/index.html
Module Bonsai_web_ui_file
An API that allows one to read files from the client's local disk.
A value of type t
can be created in two ways:
1. Using the companion library Bonsai_web_ui_file_from_web_file
, which uses the Web File API to drive t
. Note that the Web File API does not permit the reading of arbitrary files on the client computer's disk. Instead, one typically uses a file selector form to allow the user to specify a file to be read. See Bonsai_web_ui_form.Elements.File_picker
for a convenient wrapper.
2. For tests, one can also create a t
which is driven manually using the For_testing
module.
val sexp_of_t : t -> Sexplib0.Sexp.t
val filename : t -> string
val contents : t -> string Core.Or_error.t Ui_effect.t
Get the contents of the file. For an advanced API that includes e.g. progress on loading the file, and the ability to abort in-progress reads, see read
below.
module Progress : sig ... end
module Read_error : sig ... end
module File_read : sig ... end
val read :
?on_progress:(Progress.t -> unit Ui_effect.t) ->
t ->
File_read.t Ui_effect.t
module Read_on_change : sig ... end
Functions that take bonsai values that contain t
, and kicking off reads whenever those values change.
module For_testing : sig ... end
This module supports a test / simulation mode where file data can be fed in by you rather than coming from an actual file on disk.
module Expert : sig ... end