Capability first · transport second

DBOPFS.js

Provides app-scoped OPFS tables, worker I/O, backup/restore, compression, and CRUD/batch APIs.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
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

JavaScript
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

BindingFormDeclaration or signatureParameter syntax
DBOPFS_EVENT_TYPESvariable · valuevariable DBOPFS_EVENT_TYPES
DBOPFS_REASONSvariable · valuevariable DBOPFS_REASONS
defaultdefault · classclass DBOPFS
MemberKindExact public declarationParameter syntax
DBOPFS.constructorconstructorconstructor(options={})options={}
DBOPFS.readyfieldready=false;
DBOPFS.readyPromisefieldreadyPromise=Promise.resolve();
DBOPFS.applicationIdgetget applicationId()
DBOPFS.storagePathgetget storagePath()
DBOPFS.tablesgetget tables()
DBOPFS.tablessetset tables(update={tableName:'',fileName:'',value:''})update={tableName:'',fileName:'',value:''}
DBOPFS.getTableHandleasync methodasync getTableHandle(tableName='')tableName=''
DBOPFS.setasync methodasync set(tableName='',fileName='',value={}, append=false)tableName='',fileName='',value={}, append=false
DBOPFS.writeFileasync methodasync writeFile(tableName='',fileName='',fileData='',append=false)tableName='',fileName='',fileData='',append=false
DBOPFS.readFileasync methodasync readFile(tableName='',fileName='')tableName='',fileName=''
DBOPFS.getFileMetadataasync methodasync getFileMetadata(tableName='',fileName='')tableName='',fileName=''
DBOPFS.setManyasync methodasync setMany(tableName,items)tableName,items
DBOPFS.getasync methodasync get(tableName='',fileName='',force=false)tableName='',fileName='',force=false
DBOPFS.getManyasync methodasync getMany(tableName,items)tableName,items
DBOPFS.getAllasync methodasync getAll(tableName='',force=false)tableName='',force=false
DBOPFS.deleteasync methodasync delete(tableName='',fileName='')tableName='',fileName=''
DBOPFS.deleteManyasync methodasync deleteMany(tableName,fileNames)tableName,fileNames
DBOPFS.deleteTableasync methodasync deleteTable(tableName)tableName
DBOPFS.clearAllStorageasync methodasync clearAllStorage()
DBOPFS.clearasync methodasync clear(tableName)tableName
DBOPFS.getAllKeysasync methodasync getAllKeys(tableName)tableName
DBOPFS.getTableNamesasync methodasync getTableNames(discover=false)discover=false
DBOPFS.filterKeyIncludesasync methodasync filterKeyIncludes(tableName,subString='')tableName,subString=''
DBOPFS.hasKeyasync methodasync hasKey(tableName,key)tableName,key
DBOPFS.countasync methodasync count(tableName)tableName
DBOPFS.downloadCompressedPNGasync methodasync downloadCompressedPNG(name='DBOPFS-backup')name='DBOPFS-backup'
DBOPFS.restoreFromPNGasync methodasync 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

JavaScript
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));

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.