CereusDB API Documentation
    Preparing search index...

    Class OPFSStorageBackend

    Stores databases in the Origin Private File System (OPFS). Used for opfs:// locations by default when the browser supports OPFS.

    Opening a database takes a Web Lock, so a database can be open in only one tab or worker at a time.

    Implements

    Index

    Constructors

    Methods

    • List entry names of a directory; directory names end with /. Missing directories list as empty.

      Parameters

      • path: string

      Returns Promise<string[]>

    • Acquire an exclusive lock (for example across browser tabs). Rejects if it is held elsewhere.

      Parameters

      • name: string

      Returns Promise<void>

    • Read a file. Resolves to null if it does not exist.

      Parameters

      • path: string

      Returns Promise<Uint8Array<ArrayBuffer>>

    • Remove a file or directory (recursively). Missing entries are ignored.

      Parameters

      • path: string

      Returns Promise<void>

    • Release a lock acquired with lock().

      Parameters

      • name: string

      Returns Promise<void>

    • Create or replace a file. Should replace the file atomically.

      Parameters

      • path: string
      • data: Uint8Array

      Returns Promise<void>

    • Whether OPFS is available in the current environment.

      Returns boolean