UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

57 lines (56 loc) 2.13 kB
import type { FileBody, FileListObject, FileMeta, FileUploadPayload } from "../.."; import { StorageAdapter } from "../.."; import { s } from "bknd/utils"; export declare const opfsAdapterConfig: s.ObjectSchema<{ readonly root: { readonly default: ""; } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; }, { readonly title: "OPFS"; readonly description: "Origin Private File System storage"; readonly additionalProperties: false; }> & { readonly title: "OPFS"; readonly description: "Origin Private File System storage"; readonly additionalProperties: false; }; export type OpfsAdapterConfig = s.Static<typeof opfsAdapterConfig>; /** * Storage adapter for OPFS (Origin Private File System) * Provides browser-based file storage using the File System Access API */ export declare class OpfsStorageAdapter extends StorageAdapter { private config; private rootPromise; constructor(config?: Partial<OpfsAdapterConfig>); private initializeRoot; getSchema(): s.ObjectSchema<{ readonly root: { readonly default: ""; } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; }, { readonly title: "OPFS"; readonly description: "Origin Private File System storage"; readonly additionalProperties: false; }> & { readonly title: "OPFS"; readonly description: "Origin Private File System storage"; readonly additionalProperties: false; }; getName(): string; listObjects(prefix?: string): Promise<FileListObject[]>; private computeEtagFromArrayBuffer; putObject(key: string, body: FileBody): Promise<string | FileUploadPayload>; deleteObject(key: string): Promise<void>; objectExists(key: string): Promise<boolean>; private parseRangeHeader; getObject(key: string, headers: Headers): Promise<Response>; getObjectUrl(_key: string): string; getObjectMeta(key: string): Promise<FileMeta>; toJSON(_secrets?: boolean): { type: string; config: { root?: string | undefined; }; }; }