UNPKG

@squarecloud/blob

Version:
64 lines (61 loc) 3.38 kB
import { MimeType } from './mimetypes.js'; export { MimeTypes } from './enum.js'; declare class MimeTypeUtil { /** Supported mime types with their extensions */ static mimeTypesWithExtension: { "video/mp4": string[]; "video/mpeg": string[]; "video/webm": string[]; "video/x-flv": string[]; "video/x-m4v": string[]; "image/jpeg": string[]; "image/png": string[]; "image/apng": string[]; "image/tiff": string[]; "image/gif": string[]; "image/webp": string[]; "image/bmp": string[]; "image/svg+xml": string[]; "image/x-icon": string[]; "image/ico": string[]; "image/cur": string[]; "image/heic": string[]; "image/heif": string[]; "audio/wav": string[]; "audio/ogg": string[]; "audio/opus": string[]; "audio/mp4": string[]; "audio/mpeg": string[]; "audio/aac": string[]; "text/plain": string[]; "text/html": string[]; "text/css": string[]; "text/csv": string[]; "text/x-sql": string[]; "application/xml": string[]; "application/sql": string[]; "application/x-sql": string[]; "application/x-sqlite3": string[]; "application/x-pkcs12": string[]; "application/pdf": string[]; "application/json": string[]; "application/javascript": string[]; }; /** All supported mime types */ static mimeTypes: ["video/mp4" | "video/mpeg" | "video/webm" | "video/x-flv" | "video/x-m4v" | "image/jpeg" | "image/png" | "image/apng" | "image/tiff" | "image/gif" | "image/webp" | "image/bmp" | "image/svg+xml" | "image/x-icon" | "image/ico" | "image/cur" | "image/heic" | "image/heif" | "audio/wav" | "audio/ogg" | "audio/opus" | "audio/mp4" | "audio/mpeg" | "audio/aac" | "text/plain" | "text/html" | "text/css" | "text/csv" | "text/x-sql" | "application/xml" | "application/sql" | "application/x-sql" | "application/x-sqlite3" | "application/x-pkcs12" | "application/pdf" | "application/json" | "application/javascript", ...("video/mp4" | "video/mpeg" | "video/webm" | "video/x-flv" | "video/x-m4v" | "image/jpeg" | "image/png" | "image/apng" | "image/tiff" | "image/gif" | "image/webp" | "image/bmp" | "image/svg+xml" | "image/x-icon" | "image/ico" | "image/cur" | "image/heic" | "image/heif" | "audio/wav" | "audio/ogg" | "audio/opus" | "audio/mp4" | "audio/mpeg" | "audio/aac" | "text/plain" | "text/html" | "text/css" | "text/csv" | "text/x-sql" | "application/xml" | "application/sql" | "application/x-sql" | "application/x-sqlite3" | "application/x-pkcs12" | "application/pdf" | "application/json" | "application/javascript")[]]; /** * Returns the corresponding MIME type for a given file extension. * * @param extension - The file extension to search for. * @return The MIME type associated with the extension, or "text/plain" if not found. * * @example * ```js * MimeTypeUtil.fromExtension("jpeg") // "image/jpeg" | Supported * MimeTypeUtil.fromExtension("json") // "application/json" | Supported * MimeTypeUtil.fromExtension("potato") // "text/plain" | Unsupported, defaults to text/plain * ``` */ static fromExtension(extension: string): MimeType; } export { MimeType, MimeTypeUtil };