/** * Simple file storage. */ export interface Storage { /** * Save `value` to storage under given `key` as identifier. * Note: `value` needs to be JSON serializable. * Previous contents (if any) will be overwritten. * * @param {string} key Identifier to use for later retrieval * @param {T} value Data to persist * @return {Promise} Promise that resolves when data is persisted */ save(key: string, value: T): Promise; /** * Load data for given `key` from storage. * Returns a JSON deserialized representation of the data, or `undefined` if * the key could not be found. * * @param {string} key Identifier of the data as used by `save()` * @return {Promise} Promise that resolves with the data, or `undefined` if not found */ load(key: string): Promise; } export declare class SimpleFileStorage implements Storage { private _rootDir; constructor(rootDir: string); save(key: string, value: T): Promise; load(key: string): Promise; private _getFilename; } export declare class ThrottledStorage implements Storage { private _slave; private _saveQueue; private _delay; constructor(storage: Storage, throttleDelay?: number); save(key: string, value: T): Promise; load(key: string): Promise; }