JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Follow publication

How to Load & Run Local WASM Modules Without A Server Using Client-Side JavaScript

No plugins. No change to browser settings. How I applied it to my own use case.

Charmaine Chui
JavaScript in Plain English
6 min readOct 18, 2023

--

Data processing and data storage are the bread and butter of data practitioners. As a data analyst working in the healthcare sector, I tend to prefer portable storage mediums such as SQLite database to Microsoft Excel or textual file formats e.g. Comma-Separated Values (CSV) when handling large tabular datasets (over ~150 million data records).

Illustration by Author | Loading WebAssembly (WASM) modules in browser without CORS policy restriction

Use-Case: Running SQLite In-Browser (sql.js)

A key advantage of implementing SQLite in-browser via the JavaScript plugin sql.js is the lack of installation and configuration requirements.

As such, this had prompted me to develop a standalone SQLite tool which I had implemented previously using sql.js compiled to Assembly JavaScript (ASM) which runs entirely on client-side JavaScript —

Following the stable release of the WebAssembly (WASM) version of sql.js, I decided to follow up on this pet project by upgrading the plugin version from 0.x to 1.xAssembly JavaScript (ASM) to WebAssembly (WASM).

Main benefits that WASM provide over ASM include greater native decoding speed (~20 times faster) and greater scalability for adding new features required to reach native levels of performance — Source: WASM official site

Note: At present the latest release is v1.8.0 (used in this article). Link to latest plugin version can be found here.

Develop SQLite Browser Tool With sql.js (WASM)

List of pre-requisite resources

--

--

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Written by Charmaine Chui

👩‍💻 Data Analyst. Web & Software Developer. Technical Writer✍ | Trying to make the 🌐 better with baby steps👣 [ 📍SG ] LinkedIn@https://tinyurl.com/5h6cufyy

Responses (1)

Write a response