package bonsai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0c4a714146073f421f1a6179561f836b45d8dc012c743207d3481ea63bef74bf
doc/bonsai.web_ui_file/Bonsai_web_ui_file/index.html
Module Bonsai_web_ui_fileSource
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.