sqlite/sqlite-wasm
sqlite/sqlite-wasm has 1,079 GitHub stars and 91 forks. GitHot measured 0 stars in 24 hours and +2 in 7 days. Last checked 2026-11-12 07:24 UTC. Last push 2026-10-25.
SQLite Wasm conveniently wrapped as an ES Module.
实测星标增长
- 24小时
- 0
- 7天
- +2
- 15天
- 更新延迟
- 1个月
- 更新延迟
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文SQLite Wasm
SQLite Wasm conveniently wrapped as an ES Module.
Installation
npm install @sqlite.org/sqlite-wasm
Bug reports
[!Warning]
This project wraps the code of SQLite Wasm with no changes, apart from added TypeScript types. Please do not file issues or feature requests regarding the underlying SQLite Wasm code here. Instead, please follow the SQLite bug filing instructions. Filing TypeScript type related issues and feature requests is fine.
Node.js support
[!Warning]
Node.js is currently only supported for in-memory databases without persistence.
Usage
There are two ways to use SQLite Wasm:
Only the worker versions allow you to use the origin private file system (OPFS) storage back-end.
In a worker (with OPFS):
[!Warning]
For this to work, you need to set the following headers on your server:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
// In `main.ts`.
const worker = new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' });
// In `worker.ts`.
import sqlite3InitModule from '@sqlite.org/sqlite-wasm';
const sqlite3 = await sqlite3InitModule();
console.log('Running SQLite3 version', sqlite3.version.libVersion);
const db = new sqlite3.oo1.OpfsDb('/mydb.sqlite3');
try {
// Your SQLite code here.
} finally {
db.close();
}
The db object above implements the
Object-Oriented API #1.
In the main thread (without OPFS):
import sqlite3InitModule from '@sqlite.org/sqlite-wasm';
const sqlite3 = await sqlite3InitModule();
console.log('Running SQLite3 version', sqlite3.version.libVersion);
const db = new sqlite3.oo1.DB('/mydb.sqlite3', 'ct');
try {
// Your SQLite code here.
} finally {
db.close();
}
The db object above implements the
Object-Oriented API #1.
Usage with Vite
If you are using Vite, you need to add the following config option in
vite.config.ts:
import { defineConfig } from 'vite';
export default defineConfig({
server: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
optimizeDeps: {
exclude: ['@sqlite.org/sqlite-wasm'],
},
});
See our OPFS and SAH pool examples for working Vite projects.
Examples
- Main thread
- Worker
- OPFS
- OPFS with Web Locks
- Key-value storage (kvvfs)
- SAH pool with Vite
- SAH pool with webpack
- SAH pool with Parcel
- SAH pool with Rsbuild
Projects using this package
See the list of npm dependents for this package.
Contributing
See CONTRIBUTING.md for deployment, local build, and testing instructions.
Deprecations
The Worker1 and Promiser1 APIs are, as of 2026-04-15, deprecated. They will not be removed, but they also will not be extended further. It is their author's considered opinion that they are too fragile, too imperformant, and too limited for any non-toy software, and their use is actively discouraged. The "correct" way to use this library is documented in Usage section above.
Acknowledgements
This project is based on SQLite Wasm, which it conveniently wraps as an
ES Module and publishes to npm as
@sqlite.org/sqlite-wasm.
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,618 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,859 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,472 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,495 星标