unstorage
Version:
Universal Storage Layer
44 lines (38 loc) • 1.73 kB
TypeScript
import { D as Driver, S as Storage, a as StorageValue } from './types-bb85dfb7.js';
export { c as StorageMeta, U as Unwatch, b as WatchCallback, W as WatchEvent } from './types-bb85dfb7.js';
interface CreateStorageOptions {
driver?: Driver;
}
declare function createStorage(options?: CreateStorageOptions): Storage;
type Snapshot<T = string> = Record<string, T>;
declare function snapshot(storage: Storage, base: string): Promise<Snapshot<string>>;
declare function restoreSnapshot(driver: Storage, snapshot: Snapshot<StorageValue>, base?: string): Promise<void>;
declare function prefixStorage(storage: Storage, base: string): Storage;
declare function normalizeKey(key?: string): string;
declare function joinKeys(...keys: string[]): string;
declare function normalizeBaseKey(base?: string): string;
type DriverFactory<T> = (opts?: T) => Driver;
declare function defineDriver<T = any>(factory: DriverFactory<T>): DriverFactory<T>;
declare const builtinDrivers: {
azureStorageTable: string;
azureCosmos: string;
azureStorageBlob: string;
cloudflareKVHTTP: string;
cloudflareKVBinding: string;
"cloudflare-kv-http": string;
"cloudflare-kv-binding": string;
fs: string;
github: string;
http: string;
localStorage: string;
lruCache: string;
localstorage: string;
memory: string;
mongodb: string;
overlay: string;
planetscale: string;
redis: string;
azureKeyVault: string;
};
type BuiltinDriverName = keyof typeof builtinDrivers;
export { BuiltinDriverName, CreateStorageOptions, Driver, Snapshot, Storage, StorageValue, builtinDrivers, createStorage, defineDriver, joinKeys, normalizeBaseKey, normalizeKey, prefixStorage, restoreSnapshot, snapshot };