package bonsai
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/bonsai.web_ui_file/Bonsai_web_ui_file/index.html
Module Bonsai_web_ui_file
Source
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.
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.
Functions that take bonsai values that contain t
, and kicking off reads whenever those values change.
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.