Name Date Size #Lines LOC

..04-Jul-2025-

api/H04-Jul-2025-9,0594,899

common/H04-Jul-2025-2,033782

fiddle/H04-Jul-2025-1,5001,039

jaccwabyt/H04-Jul-2025-1,8241,398

sql/H04-Jul-2025-4745

EXPORTED_FUNCTIONS.fiddle.inH A D04-Jul-2025166 1110

GNUmakefileH A D04-Jul-202526.4 KiB656381

README-dist.txtH A D04-Jul-2025826 2415

README.mdH A D04-Jul-20253.3 KiB10680

batch-runner.htmlH A D04-Jul-20253.8 KiB9189

batch-runner.jsH A D04-Jul-202520.7 KiB589502

demo-123-worker.htmlH A D04-Jul-20251.4 KiB4544

demo-123.htmlH A D04-Jul-2025661 2524

demo-123.jsH A D04-Jul-20259.2 KiB290201

demo-jsstorage.htmlH A D04-Jul-20251.8 KiB5048

demo-jsstorage.jsH A D04-Jul-20253.7 KiB11594

demo-worker1-promiser.htmlH A D04-Jul-20251.4 KiB3533

demo-worker1-promiser.jsH A D04-Jul-20258.1 KiB271221

demo-worker1.htmlH A D04-Jul-20251.3 KiB3532

demo-worker1.jsH A D04-Jul-202511.5 KiB346253

dist.makeH A D04-Jul-20254.2 KiB10247

fiddle.makeH A D04-Jul-20257.8 KiB19577

index-dist.htmlH A D04-Jul-20253.4 KiB9190

index.htmlH A D04-Jul-20255.6 KiB116108

module-symbols.htmlH A D04-Jul-202511.2 KiB334300

scratchpad-wasmfs-main.htmlH A D04-Jul-20251.7 KiB4139

scratchpad-wasmfs-main.jsH A D04-Jul-20252.2 KiB7151

speedtest1-wasmfs.htmlH A D04-Jul-20255.7 KiB150144

speedtest1-worker.htmlH A D04-Jul-202514.9 KiB373366

speedtest1-worker.jsH A D04-Jul-20252.8 KiB10086

speedtest1.htmlH A D04-Jul-20256.5 KiB175169

split-speedtest1-script.shH A D04-Jul-2025615 1813

test-opfs-vfs.htmlH A D04-Jul-2025910 2726

test-opfs-vfs.jsH A D04-Jul-20252.9 KiB8663

tester1-worker.htmlH A D04-Jul-20252.2 KiB6463

tester1.htmlH A D04-Jul-2025981 2928

tester1.jsH A D04-Jul-202571.7 KiB1,8651,554

version-info.cH A D04-Jul-20253.1 KiB10787

wasmfs.makeH A D04-Jul-20255.4 KiB11471

README-dist.txt

1This is the README for the sqlite3 WASM/JS distribution.
2
3Main project page: https://sqlite.org
4
5Documentation: https://sqlite.org/wasm
6
7This archive contains the sqlite3.js and sqlite3.wasm file which make
8up the sqlite3 WASM/JS build.
9
10The jswasm directory contains the core sqlite3 deliverables and the
11top-level directory contains demonstration and test apps. Browsers
12will not serve WASM files from file:// URLs, so the demo/test apps
13require a web server and that server must include the following
14headers in its response when serving the files:
15
16    Cross-Origin-Opener-Policy: same-origin
17    Cross-Origin-Embedder-Policy: require-corp
18
19One simple way to get the demo apps up and running on Unix-style
20systems is to install althttpd (https://sqlite.org/althttpd) and run:
21
22    althttpd --enable-sab --page index.html
23
24

README.md

1This directory houses the [Web Assembly (WASM)](https://en.wikipedia.org/wiki/WebAssembly)
2parts of the sqlite3 build.
3
4It requires [emscripten][] and that the build environment be set up for
5emscripten. A mini-HOWTO for setting that up follows...
6
7First, install the Emscripten SDK, as documented
8[here](https://emscripten.org/docs/getting_started/downloads.html) and summarized
9below for Linux environments:
10
11```
12# Clone the emscripten repository:
13$ sudo apt install git
14$ git clone https://github.com/emscripten-core/emsdk.git
15$ cd emsdk
16
17# Download and install the latest SDK tools:
18$ ./emsdk install latest
19
20# Make the "latest" SDK "active" for the current user:
21$ ./emsdk activate latest
22```
23
24Those parts only need to be run once, but the SDK can be updated using:
25
26```
27$ git pull
28$ ./emsdk install latest
29$ ./emsdk activate latest
30```
31
32The following needs to be run for each shell instance which needs the
33`emcc` compiler:
34
35```
36# Activate PATH and other environment variables in the current terminal:
37$ source ./emsdk_env.sh
38
39$ which emcc
40/path/to/emsdk/upstream/emscripten/emcc
41```
42
43Optionally, add that to your login shell's resource file (`~/.bashrc`
44or equivalent).
45
46That `env` script needs to be sourced for building this application
47from the top of the sqlite3 build tree:
48
49```
50$ make fiddle
51```
52
53Or:
54
55```
56$ cd ext/wasm
57$ make
58```
59
60That will generate the a number of files required for a handful of
61test and demo applications which can be accessed via
62`index.html`. WASM content cannot, due to XMLHttpRequest security
63limitations, be loaded if the containing HTML file is opened directly
64in the browser (i.e. if it is opened using a `file://` URL), so it
65needs to be served via an HTTP server.  For example, using
66[althttpd][]:
67
68```
69$ cd ext/wasm
70$ althttpd --enable-sab --max-age 1 --page index.html
71```
72
73That will open the system's browser and run the index page, from which
74all of the test and demo applications can be accessed.
75
76Note that when serving this app via [althttpd][], it must be a version
77from 2022-09-26 or newer so that it recognizes the `--enable-sab`
78flag, which causes althttpd to emit two HTTP response headers which
79are required to enable JavaScript's `SharedArrayBuffer` and `Atomics`
80APIs. Those APIs are required in order to enable the OPFS-related
81features in the apps which use them.
82
83# Testing on a remote machine that is accessed via SSH
84
85*NB: The following are developer notes, last validated on 2022-08-18*
86
87  *  Remote: Install git, emsdk, and althttpd
88     *  Use a [version of althttpd][althttpd] from
89        September 26, 2022 or newer.
90  *  Remote: Install the SQLite source tree.  CD to ext/wasm
91  *  Remote: "`make`" to build WASM
92  *  Remote: `althttpd --enable-sab --port 8080 --popup`
93  *  Local:  `ssh -L 8180:localhost:8080 remote`
94  *  Local:  Point your web-browser at http://localhost:8180/index.html
95
96In order to enable [SharedArrayBuffers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer),
97the web-browser requires that the two extra Cross-Origin lines be present
98in HTTP reply headers and that the request must come from "localhost".
99Since the web-server is on a different machine from
100the web-broser, the localhost requirement means that the connection must be tunneled
101using SSH.
102
103
104[emscripten]: https://emscripten.org
105[althttpd]: https://sqlite.org/althttpd
106