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

@aiao/rxdb-adapter-sqlite-wasm

v0.0.25

Published

RxDB SQLite 适配器,基于 [@subframe7536/sqlite-wasm](https://github.com/subframe7536/sqlite-wasm)。

Readme

@aiao/rxdb-adapter-sqlite-wasm

RxDB SQLite 适配器,基于 @subframe7536/sqlite-wasm

@aiao/rxdb-adapter-wa-sqlite 共享 @aiao/rxdb-adapter-sqlite-core 中的核心能力;差异在于底层 SQLite WASM 由 subframe 包提供(自定义 wa-sqlite,支持 FTS5 / UPDATE DELETE LIMIT,内置 typesafe VFS 预设)。

何时使用

  • 需要 subframe 提供的增强 SQLite 特性(UPDATE/DELETE LIMIT)
  • 需要类型安全的 VFS 预设
  • 需要更灵活的 VFS 选择(包括 OPFS FileHandle)

与其他 SQLite 适配器对比

| 特性 | sqlite-wasm | wa-sqlite | sqlite-wasm (官方) | | ------------------- | ------------------------- | --------- | ----------------------- | | 底层库 | @subframe7536/sqlite-wasm | wa-sqlite | @sqlite.org/sqlite-wasm | | UPDATE/DELETE LIMIT | ✅ | ❌ | ❌ | | VFS 预设 | 类型安全 | 手动配置 | 手动配置 | | OPFS FileHandle | ✅ | ❌ | ✅ | | 包大小 | ~800KB | ~500KB | ~1MB |

支持的存储(VFS 预设)

| vfs 取值 | 说明 | 运行环境 | | ------------ | --------------------------------------------- | --------------- | | memory | 纯内存,MemoryVFS | 主线程/Worker | | idb | IndexedDB,IDBBatchAtomicVFS | 主线程/Worker | | idb-memory | 内存 + IndexedDB 镜像,IDBMirrorVFS | 主线程/Worker | | opfs | OPFS,OPFSCoopSyncVFS | 必须 Worker | | fs-handle | 本地文件/OPFS FileHandle,OPFSAnyContextVFS | 主线程/Worker |

安装

npm install @aiao/rxdb @aiao/rxdb-adapter-sqlite-wasm
# 或
pnpm add @aiao/rxdb @aiao/rxdb-adapter-sqlite-wasm

走 Worker / SharedWorker(opfs 强制要求)时,Worker 文件需要你自己 import { expose } from 'comlink', 因此还要装 comlink —— 它是本包的可选 peer 依赖,严格模式的 pnpm 不会把 core 的传递依赖暴露给你:

npm install comlink
# 或
pnpm add comlink

用法

import { RxDB, SyncType } from '@aiao/rxdb';
import { RxDBAdapterSqlite } from '@aiao/rxdb-adapter-sqlite-wasm';

const rxdb = new RxDB({
  dbName: 'my-app',
  entities: [/* 实体类 */],
  sync: {
    local: { adapter: 'sqlite-wasm' },
    type: SyncType.None
  }
});

rxdb.adapter('sqlite-wasm', async db => new RxDBAdapterSqlite(db, { vfs: 'idb' }));

await rxdb.connect('sqlite-wasm');

在 Worker 中运行(opfs VFS 必须 Worker):

// sqlite-wasm.worker.ts
import { SqliteClient } from '@aiao/rxdb-adapter-sqlite-wasm';
import { expose } from 'comlink';

expose(new SqliteClient());
// 主线程:workerInstance 本身即可选择 Worker transport
rxdb.adapter(
  'sqlite-wasm',
  async db =>
    new RxDBAdapterSqlite(db, {
      vfs: 'opfs',
      worker: true,
      workerInstance: new Worker(new URL('./sqlite-wasm.worker', import.meta.url), { type: 'module' }),
      workerOwnership: 'client'
    })
);

workerOwnership 默认是 caller:同一个 Worker 可在 disconnect 后建立新连接, 但调用方最终必须执行 worker.terminate()。像上例一样在 adapter 工厂内创建 Worker 时, 应使用 client,这样断开或初始化失败都会释放 Comlink 端口并终止线程。

直接调用 createSqliteClient 时,先 await client.disconnect(),再调用包根入口导出的 releaseComlinkProxy(client)RxDBAdapterSqlite 已在 disconnect() 内自动完成代理释放。

完整示例

参考 dev-rxdb-angular 中的集成示例。