Module File_to_htmlSource

This file allows to put binary files in HTML documents (by base64 encoding), so that the binary file is accessible by javascript as a Uint8Array. Can be used e.g. for Marshalling OCaml data to the browser, which simplifies UI development (compared to using a webserver, with asynchronous requests following some protocols etc.)

Warning:

Sourceval file_to_html : out_channel -> filename:string -> varid:string -> unit

Generate HTML <script>...<script> node in outc such that the content of filename will be placed in the Javascript variable varid, which is a Uint8Array.

Note: this require preamble (which is also a <script>...<script>) to be placed before.

Sourceval preamble : string

A preamble string to be placed in the HTML file before the sequence of file_to_html calls start.