Skip to content

Browser Database 总览

浏览器数据层不是一个 API:IndexedDB 保存结构化记录,OPFS 提供来源私有文件系统,Cache API 保存请求响应,Storage Manager 管理配额和持久化请求。WASM 数据库通常在这些原语之上实现虚拟文件系统。

能力数据模型访问方式适合
IndexedDBKey + 结构化克隆对象异步事务 API应用状态、离线数据、Blob
OPFS文件与目录Worker 同步句柄/异步 APISQLite、PGlite 等 WASM 文件系统
Cache APIRequest / ResponsePromise API离线网络资源
localStorage字符串键值主线程同步极少量简单偏好,不适合数据库

下一步:IndexedDB 原理与实践

Released under the MIT License.