🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

bare-sqlite-vector

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-sqlite-vector

SQLite Vector bindings for Bare

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

bare-sqlite-vector

SQLite Vector bindings for Bare. Statically embeds the sqlite-vector extension from https://github.com/sqliteai/sqlite-vector and registers it against an existing bare-sqlite connection from https://github.com/holepunchto/bare-sqlite, adding vector encoding, nearest-neighbour search, and quantization-based ANN search to ordinary SQLite tables.

npm i bare-sqlite-vector

Usage

const { DatabaseSync } = require('bare-sqlite')
const vector = require('bare-sqlite-vector')

const db = new DatabaseSync(':memory:')
vector.register(db)

db.exec(`
  CREATE TABLE points (id INTEGER PRIMARY KEY, v BLOB);
  INSERT INTO points (v) VALUES (vector_as_f32('[1.0, 0.0, 0.0, 0.0]'));
  INSERT INTO points (v) VALUES (vector_as_f32('[0.0, 1.0, 0.0, 0.0]'));
`)

db.prepare("SELECT vector_init('points', 'v', 'type=FLOAT32,dimension=4,distance=L2')").get()

const rows = db
  .prepare(
    "SELECT rowid, distance FROM vector_full_scan('points', 'v', vector_as_f32('[0.9, 0.1, 0.0, 0.0]'), 2)"
  )
  .all()

API

vector.register(db)

Register the vector extension's SQL functions and virtual table modules on the given bare-sqlite connection. db must be an open DatabaseSync instance from bare-sqlite.

Registration is per-connection; each new DatabaseSync that needs vector functions must call register again. The call is idempotent: Invoking it more than once on the same connection is a no-op.

Throws DATABASE_NOT_OPEN if db has been closed.

License

Apache-2.0 and Elastic-2.0

FAQs

Package last updated on 26 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts