meta-log-db
Version:
Native database package for Meta-Log (ProLog, DataLog, R5RS)
64 lines • 1.65 kB
TypeScript
/**
* Browser File I/O Abstraction Layer
*
* Provides file loading from URLs/public directory and IndexedDB caching
*/
export interface BrowserFileIOConfig {
enableCache?: boolean;
cacheStrategy?: 'memory' | 'indexeddb' | 'both';
indexedDBName?: string;
}
/**
* Browser File I/O Manager
*/
export declare class BrowserFileIO {
private cache;
private storage;
private enableCache;
private cacheStrategy;
constructor(config?: BrowserFileIOConfig);
/**
* Initialize storage (async initialization)
*/
init(): Promise<void>;
/**
* Load file from URL/public directory
*/
loadFromURL(url: string): Promise<string>;
/**
* Load file from IndexedDB cache
*/
loadFromIndexedDB(key: string): Promise<string | null>;
/**
* Save file to IndexedDB cache
*/
saveToIndexedDB(key: string, content: string): Promise<void>;
/**
* Check if file exists in IndexedDB cache
*/
existsInIndexedDB(key: string): Promise<boolean>;
/**
* Load file with fallback strategy:
* 1. Try IndexedDB cache
* 2. Try fetch from URL/public directory
* 3. Cache in IndexedDB if successful
*/
loadFile(path: string, url?: string): Promise<string>;
/**
* Save to cache (memory and/or IndexedDB)
*/
private saveToCache;
/**
* Clear cache
*/
clearCache(): Promise<void>;
/**
* Clear specific file from cache
*/
clearFileCache(key: string): Promise<void>;
/**
* Check if file is cached
*/
isCached(key: string): Promise<boolean>;
}
//# sourceMappingURL=io.d.ts.map