SQLite storage adapter for MTKruto.
- Driver-agnostic: works with
better-sqlite3andbun:sqlite - Synchronous API (no async overhead)
- Supports branching, range queries, and atomic
incr - Stores all value types including
BigIntandUint8Array
- Node.js with
better-sqlite3, or Bun withbun:sqlite
# npm
npm install mtkruto-storage-sqlite
# bun
bun add mtkruto-storage-sqliteimport { Database } from "bun:sqlite";
import { StorageSqlite } from "mtkruto-storage-sqlite";
const db = new Database("session.db");
const storage = new StorageSqlite(db);import Database from "better-sqlite3";
import { StorageSqlite } from "mtkruto-storage-sqlite";
const db = new Database("session.db");
const storage = new StorageSqlite(db);import { Client } from "@mtkruto/node";
const client = new Client(storage, apiId, apiHash);
await client.connect();Creates a new storage instance. The db parameter must implement the SqliteDatabase interface (compatible with both better-sqlite3 and bun:sqlite).
Creates the required table and prepares statements. Must be called before use — MTKruto calls this automatically.
Returns a child storage instance that shares the same database connection but namespaces all keys under id.
# Build
npm run build
# Run tests
bun testGNU Lesser General Public License v3.0 — see COPYING.LESSER for details.
Copyright (C) 2026 https://github.com/KeksKlip