On this page
Overview
Provides app-scoped OPFS tables, worker I/O, backup/restore, compression, and CRUD/batch APIs.
- Artifact
DBOPFS.js· esm - Classification
public first party - Availability
Browser / native WebView - Normalization
App scope and recognized file parsing are normalized; nonblank unreadable JSONL rows remain complete raw strings, and DOM/storage errors are preserved.
Import and lifecycle
import * as module from '/arcane/modules/DBOPFS.js';
Browser import installs window.dbopfs, asynchronously opens or creates the app OPFS scope and default tables, emits dbopfs-ready, and CRUD and backup methods read, write, delete, download, or restore files.
Application-facing behavior: default DBOPFS; installs window.dbopfs, emits dbopfs-ready; table/file/backup APIs.
Protocol and host implementation
OPFS, DBOPFSWorker, Compression Streams, and per-realm globalThis.arcaneEvents authority This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
DBOPFS_EVENT_TYPES | variable · value | variable DBOPFS_EVENT_TYPES | — |
DBOPFS_REASONS | variable · value | variable DBOPFS_REASONS | — |
default | default · class | class DBOPFS | — |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
DBOPFS.constructor | constructor | constructor(options={}) | options={} |
DBOPFS.ready | field | ready=false; | — |
DBOPFS.readyPromise | field | readyPromise=Promise.resolve(); | — |
DBOPFS.applicationId | get | get applicationId() | — |
DBOPFS.storagePath | get | get storagePath() | — |
DBOPFS.tables | get | get tables() | — |
DBOPFS.tables | set | set tables(update={tableName:'',fileName:'',value:''}) | update={tableName:'',fileName:'',value:''} |
DBOPFS.getTableHandle | async method | async getTableHandle(tableName='') | tableName='' |
DBOPFS.set | async method | async set(tableName='',fileName='',value={}, append=false) | tableName='',fileName='',value={}, append=false |
DBOPFS.writeFile | async method | async writeFile(tableName='',fileName='',fileData='',append=false) | tableName='',fileName='',fileData='',append=false |
DBOPFS.readFile | async method | async readFile(tableName='',fileName='') | tableName='',fileName='' |
DBOPFS.getFileMetadata | async method | async getFileMetadata(tableName='',fileName='') | tableName='',fileName='' |
DBOPFS.setMany | async method | async setMany(tableName,items) | tableName,items |
DBOPFS.get | async method | async get(tableName='',fileName='',force=false) | tableName='',fileName='',force=false |
DBOPFS.getMany | async method | async getMany(tableName,items) | tableName,items |
DBOPFS.getAll | async method | async getAll(tableName='',force=false) | tableName='',force=false |
DBOPFS.delete | async method | async delete(tableName='',fileName='') | tableName='',fileName='' |
DBOPFS.deleteMany | async method | async deleteMany(tableName,fileNames) | tableName,fileNames |
DBOPFS.deleteTable | async method | async deleteTable(tableName) | tableName |
DBOPFS.clearAllStorage | async method | async clearAllStorage() | — |
DBOPFS.clear | async method | async clear(tableName) | tableName |
DBOPFS.getAllKeys | async method | async getAllKeys(tableName) | tableName |
DBOPFS.getTableNames | async method | async getTableNames(discover=false) | discover=false |
DBOPFS.filterKeyIncludes | async method | async filterKeyIncludes(tableName,subString='') | tableName,subString='' |
DBOPFS.hasKey | async method | async hasKey(tableName,key) | tableName,key |
DBOPFS.count | async method | async count(tableName) | tableName |
DBOPFS.downloadCompressedPNG | async method | async downloadCompressedPNG(name='DBOPFS-backup') | name='DBOPFS-backup' |
DBOPFS.restoreFromPNG | async method | async restoreFromPNG(file) | file |
Parameter meanings and results
After readyPromise, DBOPFS supports table and file set, get, batch, filter, count, and delete APIs plus PNG-compressed backup and restore. Storage is rooted at apps/<authoritative-app-id>, and worker fallback handles synchronous OPFS access.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
- dbopfs-ready
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- APP_DATA_SCOPE_INVALID
- APP_DATA_SCOPE_MISMATCH
- APP_DATA_SCOPE_REQUIRED
- APP_DATA_STORAGE_UNAVAILABLE
- DOM, OPFS, worker, serialization, compression, and backup validation failures
Availability and capabilities
Browser / native WebView. App scope and recognized file parsing are normalized; nonblank unreadable JSONL rows remain complete raw strings, and DOM/storage errors are preserved.
Normalized app-scoped browser and native-WebView persistence; Arcane.app.current supplies authoritative identity when native, but Core is not a database service.
Contract example
import '/arcane/modules/DBOPFS.js';
await window.dbopfs.readyPromise;
await window.dbopfs.set('notes','welcome',{text:'Hello'});
console.log(await window.dbopfs.get('notes','welcome',true));
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.