/// /// /// import { ReadStream } from 'fs'; interface Config { sizeLimit?: number; baseUrl?: string; prefix?: string; debug?: boolean; /** * If true, providing `pathDir` that sanitizes to an empty string will throw instead of falling back. */ strictPathDir?: boolean; /** * If true, after deleting a file, try to remove empty parent directories under uploads root. */ cleanupEmptyDirs?: boolean; /** * If true, after deleting a file, try to delete empty Media Library folders (Admin) as well. * Safety rules: * - only deletes a folder if it has no child folders * - only deletes a folder if it has no other files (excluding the file currently being deleted) * - then repeats the same check for the parent folder (recursive upwards) */ cleanupEmptyAdminFolders?: boolean; /** * If true (default), when `pathDir` is not provided, filesystem path will use `path` (admin path) for compatibility. */ usePathAsPathDir?: boolean; /** * Marker used to extract objectPath from url during delete. Default: "/uploads/". */ uploadsUrlMarker?: string; /** * If true, saved file name becomes `_` (e.g. `a1b2c3d4-..._abc123hash.ext`). * Strapi's hash is still used; the UUID is added for a unique, non-guessable filename. */ renameToUuid?: boolean; /** * If true, enables private folder: files under this path are only accessible when authenticated * (Admin: full access; API: only if JWT user's documentId matches path, or valid HMAC URL). */ privateEnable?: boolean; /** * Name of the private folder in filesystem and Admin (no leading/trailing slashes). Default: "private". * URL pattern: /uploads///file.ext */ privateFolder?: string; /** * TTL in seconds for HMAC-signed URLs. Default: 60. */ privateTTL?: number; /** * Secret for HMAC-signed URLs (required if you want ?token=...&expires=... access). */ privateSecret?: string; /** * Field on the users-permissions user entity used as documentId for path matching. Default: "id". */ privateUserDocumentIdField?: string; } export interface File { stream?: ReadStream; buffer?: Buffer; name?: string; alternativeText?: string; caption?: string; width?: number; height?: number; formats?: Record; hash: string; ext?: string; mime?: string; size?: number; sizeInBytes?: number; url?: string; previewUrl?: string; path?: string; folder?: number | null; folderPath?: string | null; provider?: string; } /** * Initialize the plugin with configuration * @param config Provider configuration * @returns Provider object with upload, uploadStream, and delete handlers */ export declare function init(config?: Config): { isPrivate(file?: File): boolean; getSignedUrl(file: File, customParams?: Record): Promise<{ url: string; }>; checkFileSize(file: File, options?: { sizeLimit?: number; }): void; uploadStream(file: File, customParams?: Record): Promise; upload(file: File, customParams?: Record): Promise; delete(file: File, customParams?: Record): Promise<"File doesn't exist" | undefined>; }; export default init;