export interface StoredFile { readonly body: Uint8Array readonly size: number /** The type the storage serves the file with, when it says (checked after direct uploads). */ readonly contentType?: string } /** Where uploaded files live. Keys are generated by Easy CMS: `-.`. */ export interface StorageAdapter { readonly name: string /** * The adapter interface it is written for (`ADAPTER_API_VERSION`); Easy CMS refuses another. * Leave it out to skip the check. */ readonly apiVersion?: number /** Called once with the project root, before any other method. */ init?(args: { cwd: string }): void | Promise put(key: string, data: Uint8Array, options: { contentType: string }): Promise get(key: string): Promise delete(key: string): Promise /** * Origins browsers send files to with `uploadURL` (direct uploads of large files), e.g. * `https://vercel.com`: the admin allows them in its Content-Security-Policy (`connect-src`). */ readonly uploadOrigins?: readonly string[] /** * Public URL of a file, or `undefined` to serve it through the REST API * (`/media/file/`), as the local adapter does. */ url?(key: string): string | undefined /** * Lets a browser send a file straight to the storage (large files, past a host's request * limit): where to send it and how. The URL must work for `expiresIn` seconds and accept at * most `size` bytes. Without it, files are uploaded through the server. */ uploadURL?( key: string, options: { contentType: string; size: number; expiresIn: number }, ): Promise /** * The first `bytes` of a file and its whole size, without reading it all (to check a file * uploaded straight to the storage); `null` when there is no such file. Default: `get`. */ getStart?(key: string, bytes: number): Promise } /** Where and how a browser sends a file straight to the storage (`StorageAdapter.uploadURL`). */ export interface DirectUpload { readonly url: string readonly method: 'PUT' | 'POST' /** Headers to send with the file. */ readonly headers: Readonly> } export { type DiskStorageOptions, diskStorage } from './runtime/node/disk-storage.js'