UNPKG

@quasarbright/projection

Version:

A static site generator that creates a beautiful, interactive gallery to showcase your coding projects. Features search, filtering, tags, responsive design, and an admin UI.

89 lines 2.77 kB
/** * Image manager for handling thumbnail uploads and deletions */ /** * Image manager class for handling thumbnail operations */ export declare class ImageManager { private screenshotsDir; private projectRoot; constructor(projectRoot: string); /** * Ensure the screenshots directory exists */ ensureScreenshotsDir(): Promise<void>; /** * Validate an uploaded file * @throws Error if validation fails */ validateFile(file: { mimetype: string; size: number; }): void; /** * Get the file extension from a MIME type */ private getExtensionFromMimeType; /** * Find an existing thumbnail for a project * @returns The filename of the existing thumbnail, or null if not found */ findExistingThumbnail(projectId: string): Promise<string | null>; /** * Save an image file for a project * @param projectId The project ID * @param file The uploaded file with buffer and mimetype * @returns The relative path to the saved image */ saveImage(projectId: string, file: { buffer: Buffer; mimetype: string; size: number; }): Promise<string>; /** * Delete an image file for a project * @param projectId The project ID */ deleteImage(projectId: string): Promise<void>; /** * Save a temporary image file for a project being edited * @param projectId The project ID * @param file The uploaded file with buffer and mimetype * @returns The relative path to the saved temporary image with admin:// prefix */ saveTempImage(projectId: string, file: { buffer: Buffer; mimetype: string; size: number; }): Promise<string>; /** * Commit a temporary image (rename from .temp to final name) * @param projectId The project ID */ commitTempImage(projectId: string): Promise<string | null>; /** * Delete a temporary image file * @param projectId The project ID */ deleteTempImage(projectId: string): Promise<void>; /** * Get the relative path for a thumbnail * @param projectId The project ID * @param extension The file extension (including the dot) * @returns The relative path with admin:// prefix (e.g., "admin://project-id.png") */ getRelativePath(projectId: string, extension: string): string; /** * Get the list of supported file extensions */ static getSupportedExtensions(): string[]; /** * Get the list of supported MIME types */ static getSupportedMimeTypes(): string[]; /** * Get the maximum file size in bytes */ static getMaxFileSize(): number; } //# sourceMappingURL=image-manager.d.ts.map