| 1 |
This is the README for the sqlite3 WASM/JS distribution. |
| 2 |
|
| 3 |
Main project page: https://sqlite.org |
| 4 |
|
| 5 |
Documentation: https://sqlite.org/wasm |
| 6 |
|
| 7 |
This archive contains the following deliverables for the WASM/JS |
| 8 |
build: |
| 9 |
|
| 10 |
- jswasm/sqlite3.js is the canonical "vanilla JS" version. |
| 11 |
|
| 12 |
- jswasm/sqlite3.mjs is the same but in ES6 module form |
| 13 |
|
| 14 |
- jswasm/*-bundler-friendly.js and .mjs are variants which are |
| 15 |
intended to be compatible with "bundler" tools commonly seen in |
| 16 |
node.js-based projects. Projects using such tools should use those |
| 17 |
variants, where available, instead of files without the |
| 18 |
"-bundler-friendly" suffix. Some files do not have separate |
| 19 |
variants. |
| 20 |
|
| 21 |
- jswasm/sqlite3.wasm is the binary WASM file imported by all of the |
| 22 |
above-listed JS files. |
| 23 |
|
| 24 |
- The jswasm directory additionally contains a number of supplemental |
| 25 |
JS files which cannot be bundled directly with the main JS files |
| 26 |
but are necessary for certain usages. |
| 27 |
|
| 28 |
- The top-level directory contains various demonstration and test |
| 29 |
applications for sqlite3.js and sqlite3.mjs. |
| 30 |
sqlite3-bundler-friendly.mjs requires client-side build tools to make |
| 31 |
use of and is not demonstrated here. |
| 32 |
|
| 33 |
Browsers will not serve WASM files from file:// URLs, so the test and |
| 34 |
demonstration apps require a web server and that server must include |
| 35 |
the following headers in its response when serving the files: |
| 36 |
|
| 37 |
Cross-Origin-Opener-Policy: same-origin |
| 38 |
Cross-Origin-Embedder-Policy: require-corp |
| 39 |
|
| 40 |
The core library will function without those headers but certain |
| 41 |
features, most notably OPFS storage, will not be available. |
| 42 |
|
| 43 |
One simple way to get the demo apps up and running on Unix-style |
| 44 |
systems is to install althttpd (https://sqlite.org/althttpd) and run: |
| 45 |
|
| 46 |
althttpd --enable-sab --page index.html |