import path from "path"; const IMAGE_EXTENSIONS = new Set(["jpg", "jpeg", "png", "webp", "gif", "bmp"]); /** * Check if a file path within an archive is an image. */ export function isImageFile(filePath: string): boolean { const ext = path.extname(filePath).toLowerCase().slice(1); return IMAGE_EXTENSIONS.has(ext); } /** * Get the MIME type for an image file extension. */ export function getImageMimeType(filePath: string): string { const ext = path.extname(filePath).toLowerCase().slice(1); switch (ext) { case "jpg": case "jpeg": return "image/jpeg"; case "png": return "image/png"; case "webp": return "image/webp"; case "gif": return "image/gif"; case "bmp": return "image/bmp"; default: return "application/octet-stream"; } }