JSPM

  • Created
  • Published
  • Downloads 185
  • Score
    100M100P100Q96861F
  • License MIT

A key-value store with SQLite that uses bun:sqlite and v8 as a fast Json replacement.

Package Exports

  • bun-sqlite-key-value
  • bun-sqlite-key-value/src/index.ts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bun-sqlite-key-value) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Bun SQLite Key Value

A key-value store with SQLite that uses bun:sqlite and v8 as a fast JSON replacement.

The ideas for the implementation come from bun-sqlite-cache and bun-kv.

Installation

bun add bun-sqlite-key-value

Usage

Using this key value store is dead simple: simply create a new BunSQLiteKeyValue instance and you're set

import { BunSQLiteKeyValue } from "bun-sqlite-key-value";

const store = new BunSQLiteKeyValue();

store.set("foo", {bar: "baz", waldo: [4, 3, 2, 8]});
const value = store.get("foo");

console.log(value) // { bar: "baz", waldo: [4, 3, 2, 8] }

Documentation

Open Database

const store = new BunSQLiteKeyValue([filename], [options])

  • filename The full path of the SQLite database to open. Pass an empty string ("") or ":memory:" or undefined for an in-memory database.

  • options Defaults to {readwrite: true, create: true}. If a number, then it's treated as SQLITE_OPEN_* constant flags.

Example

import { BunSQLiteKeyValue } from "bun-sqlite-key-value";
import {join} from "path"

const store = new BunSQLiteKeyValue();