npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sqlite3-wasm-nodefs

v0.0.3

Published

This directory houses the [Web Assembly (WASM)](https://en.wikipedia.org/wiki/WebAssembly) parts of the sqlite3 build.

Downloads

4

Readme

This directory houses the Web Assembly (WASM) parts of the sqlite3 build.

It requires emscripten and that the build environment be set up for emscripten. A mini-HOWTO for setting that up follows...

First, install the Emscripten SDK, as documented here and summarized below for Linux environments:

# Clone the emscripten repository:
$ sudo apt install git
$ git clone https://github.com/emscripten-core/emsdk.git
$ cd emsdk

# Download and install the latest SDK tools:
$ ./emsdk install latest

# Make the "latest" SDK "active" for the current user:
$ ./emsdk activate latest

Those parts only need to be run once, but the SDK can be updated using:

$ git pull
$ ./emsdk install latest
$ ./emsdk activate latest

The following needs to be run for each shell instance which needs the emcc compiler:

# Activate PATH and other environment variables in the current terminal:
$ source ./emsdk_env.sh

$ which emcc
/path/to/emsdk/upstream/emscripten/emcc

Optionally, add that to your login shell's resource file (~/.bashrc or equivalent).

That env script needs to be sourced for building this application from the top of the sqlite3 build tree:

$ make fiddle

Or:

$ cd ext/wasm
$ make

That will generate the a number of files required for a handful of test and demo applications which can be accessed via index.html. WASM content cannot, due to XMLHttpRequest security limitations, be loaded if the containing HTML file is opened directly in the browser (i.e. if it is opened using a file:// URL), so it needs to be served via an HTTP server. For example, using althttpd:

$ cd ext/wasm
$ althttpd --enable-sab --max-age 1 --page index.html

That will open the system's browser and run the index page, from which all of the test and demo applications can be accessed.

Note that when serving this app via althttpd, it must be a version from 2022-09-26 or newer so that it recognizes the --enable-sab flag, which causes althttpd to emit two HTTP response headers which are required to enable JavaScript's SharedArrayBuffer and Atomics APIs. Those APIs are required in order to enable the OPFS-related features in the apps which use them.

Testing on a remote machine that is accessed via SSH

NB: The following are developer notes, last validated on 2022-08-18

  • Remote: Install git, emsdk, and althttpd
  • Remote: Install the SQLite source tree. CD to ext/wasm
  • Remote: "make" to build WASM
  • Remote: althttpd --enable-sab --port 8080 --popup
  • Local: ssh -L 8180:localhost:8080 remote
  • Local: Point your web-browser at http://localhost:8180/index.html

In order to enable SharedArrayBuffers, the web-browser requires that the two extra Cross-Origin lines be present in HTTP reply headers and that the request must come from "localhost". Since the web-server is on a different machine from the web-broser, the localhost requirement means that the connection must be tunneled using SSH.

Nodefs (Node.js file system)

The package is published as sqlite3-wasm in npm, check ./test-wasmfs.js for learning the use cases.