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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tan-yong-sheng/sqlite-vec-wasm-node

v1.0.0

Published

WebAssembly build of SQLite3 with sqlite-vec for Node.js with file system access

Readme

@tan-yong-sheng/sqlite-vec-wasm-node

WebAssembly build of SQLite3 with sqlite-vec for Node.js with file system access.

Features

  • No native compilation required - Pure WebAssembly, works on any platform
  • File persistence - Direct file system access via Node.js fs API
  • Vector search built-in - sqlite-vec extension compiled in for semantic search
  • Cross-platform - Same binary works on Linux (x64/ARM64), macOS (x64/ARM64), Windows

Installation

npm install @tan-yong-sheng/sqlite-vec-wasm-node

Usage

const { Database } = require('@tan-yong-sheng/sqlite-vec-wasm-node');

// Open a database file (created if doesn't exist)
const db = new Database('mydb.sqlite');

// Check versions
const version = db.get('SELECT sqlite_version() as sqlite, vec_version() as vec');
console.log(`SQLite: ${version.sqlite}, sqlite-vec: ${version.vec}`);

// Create a vector table
db.exec(`
  CREATE VIRTUAL TABLE IF NOT EXISTS embeddings
  USING vec0(
    id TEXT PRIMARY KEY,
    embedding FLOAT[1536]
  )
`);

// Insert vectors
const embedding = new Float32Array(1536); // your embedding vector
db.run('INSERT INTO embeddings (id, embedding) VALUES (?, ?)', ['doc1', embedding.buffer]);

// Vector search
const query = new Float32Array(1536); // your query vector
const results = db.all(`
  SELECT id, vec_distance_cosine(embedding, ?) as distance
  FROM embeddings
  ORDER BY distance
  LIMIT 10
`, [query.buffer]);

console.log(results);

db.close();

Why This Package?

Problem with Native SQLite

Native SQLite bindings like better-sqlite3 require compilation for each platform:

  • Linux x64, Linux ARM64, macOS x64, macOS ARM64, Windows x64
  • Each build must be compiled on a machine with matching GLIBC version
  • Binary compatibility issues (e.g., GLIBC 2.38 vs 2.35)

WASM Solution

This package uses WebAssembly:

  • Single binary - Works everywhere
  • No GLIBC dependency - Runs in any Node.js environment
  • File persistence - Custom VFS maps SQLite file operations to Node.js fs API

Building from Source

Prerequisites:

  • Docker (for Emscripten toolchain)
  • Node.js 18+
# Build the WASM module
make download  # Download SQLite and sqlite-vec sources
make           # Compile with Emscripten

API

new Database(path, options?)

Create a new database connection.

  • path - Path to the database file
  • options.fileMustExist - Throw error if file doesn't exist (default: false)
  • options.readOnly - Open in read-only mode (default: false)

Database#exec(sql)

Execute SQL statements.

Database#prepare(sql) -> Statement

Create a prepared statement.

Database#run(sql, values?) -> { changes, lastInsertRowid }

Execute a statement and return metadata.

Database#all(sql, values?) -> Row[]

Execute a query and return all rows.

Database#get(sql, values?) -> Row | null

Execute a query and return the first row.

Database#close()

Close the database connection.

License

MIT

Credits

Build test