/** * Origin Private File System (OPFS) Storage Backend * * High-performance browser storage using the File System Access API. * OPFS provides file-like semantics for browser persistence. Performance is * browser- and workload-dependent and should be measured for the target app. * * Features: * - Auto-initializing (no manual init() required) * - High performance for large binary data * * Browser Support: * - Chrome 86+ * - Safari 15.2+ * - Firefox 111+ * - Edge 86+ * * Note: This module is designed for browser environments only. * It will not work in Node.js/Bun server environments. */ import type { StorageBackend } from './StorageBackend.js'; export declare class OPFSBackend implements StorageBackend { private static mutationLocks; readonly type = "opfs"; readonly namespace: string; private root; private initialized; private initPromise; /** * Create an OPFS backend scoped to one directory in the origin root. * Keeping a namespace boundary is important: clear() must never remove * files owned by another application sharing this origin. */ constructor(namespace?: string); /** * Initialize the OPFS backend (optional - auto-initializes on first operation) * @deprecated No longer required - operations auto-initialize */ init(): Promise; private doInit; /** * Ensure backend is initialized (lazy init on first use). * Safe to call concurrently — only runs initialization once. */ private ensureInitialized; private isNotFoundError; private formatError; private normalizeStorageError; private validateAndSplitPath; private canonicalizePath; private withSameRealmMutationLock; private withMutationLock; /** * Get a file handle, creating parent directories as needed */ private getFileHandle; /** * Get a directory handle, creating if needed */ private getDirectoryHandle; read(key: string): Promise; write(key: string, data: ArrayBuffer | Uint8Array): Promise; private getOrCreateFileHandle; private removeFileUnlocked; private cleanupCreatedEmptyFile; private dataToArrayBuffer; private doWrite; append(key: string, data: ArrayBuffer | Uint8Array): Promise; private doAppend; delete(key: string): Promise; exists(key: string): Promise; list(prefix?: string): Promise; mkdir(path: string): Promise; /** Clear only this backend's namespace in OPFS. */ clear(): Promise; /** * Check if OPFS is available in the current environment */ static isAvailable(): boolean; } //# sourceMappingURL=OPFSBackend.d.ts.map