import { type SlashPathTypedFileExtension } from '../path/path'; import { type Maybe } from '../value/maybe.type'; /** * A simple mime type string with just the type/subtype and no parameters. * * I.E. "application/json" */ export type MimeTypeWithoutParameters = string; /** * The mimetype wildcard. */ export type MimeTypeWildcard = '*'; /** * A mime type with a wildcard subtype. Has a star as the subtype. * * I.E. "application/*" */ export type MimeTypeWithSubtypeWildcardWithoutParameters = string; /** * A mime type string that may contain additional parameters. * * I.E. "text/plain", "application/json; charset=utf-8" */ export type ContentTypeMimeType = string; /** * Input for mimetypeForImageType(). * * This is a non-exhaustive list of common image types. */ export type ImageFileExtension = 'jpeg' | 'jpg' | 'png' | 'webp' | 'gif' | 'svg' | 'raw' | 'heif' | 'tiff'; /** * MIME type for JPEG images. */ export declare const JPEG_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for PNG images. */ export declare const PNG_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for WebP images. */ export declare const WEBP_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for GIF images. */ export declare const GIF_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for HEIF images. */ export declare const HEIF_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for TIFF images. */ export declare const TIFF_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for SVG images. */ export declare const SVG_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for RAW images. */ export declare const RAW_MIME_TYPE: MimeTypeWithoutParameters; /** * Maps image file extensions to their corresponding MIME types. */ export declare const IMAGE_FILE_EXTENSION_TO_MIME_TYPES_RECORD: Record; /** * Maps image MIME types back to their corresponding file extensions. */ export declare const IMAGE_MIME_TYPES_TO_FILE_EXTENSIONS_RECORD: Record; /** * Returns the MIME type for the given image file extension, or undefined if the extension is not recognized. * * @param extension - the image file extension to look up * @returns the corresponding MIME type, or undefined if the extension is not known */ export declare function mimeTypeForImageFileExtension(extension: ImageFileExtension): MimeTypeWithoutParameters; export declare function mimeTypeForImageFileExtension(extension: SlashPathTypedFileExtension): Maybe; export declare function mimeTypeForImageFileExtension(extension: Maybe): Maybe; /** * Returns the image file extension for the given MIME type, or undefined if the MIME type is not a known image type. * * @param mimeType - the MIME type to look up * @returns the corresponding image file extension, or undefined if not recognized */ export declare function imageFileExtensionForMimeType(mimeType: Maybe): Maybe; /** * Non-exhaustive list of common document file extensions. */ export type DocumentFileExtension = 'pdf' | 'docx' | 'xlsx' | 'txt' | 'csv' | 'html' | 'xml' | 'json' | 'yaml' | 'md'; /** * MIME type for PDF documents. */ export declare const PDF_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for DOCX (Word) documents. */ export declare const DOCX_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for XLSX (Excel) spreadsheets. */ export declare const XLSX_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for plain text files. */ export declare const TXT_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for CSV files. */ export declare const CSV_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for HTML files. */ export declare const HTML_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for XML files. */ export declare const XML_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for JSON files. */ export declare const JSON_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for YAML files. */ export declare const YAML_MIME_TYPE: MimeTypeWithoutParameters; /** * MIME type for Markdown files. */ export declare const MARKDOWN_MIME_TYPE: MimeTypeWithoutParameters; /** * Maps document file extensions to their corresponding MIME types. */ export declare const DOCUMENT_FILE_EXTENSION_TO_MIME_TYPES_RECORD: Record; /** * Maps document MIME types back to their corresponding file extensions. */ export declare const DOCUMENT_MIME_TYPES_TO_FILE_EXTENSIONS_RECORD: Record; /** * Returns the mimetype for the given document file extension, or undefined if the extension is not known/recognized. * * @param extension The document file extension to get the mimetype for. * @returns The mimetype for the given document file extension, or undefined if the extension is not known. */ export declare function mimeTypeForDocumentFileExtension(extension: DocumentFileExtension): MimeTypeWithoutParameters; export declare function mimeTypeForDocumentFileExtension(extension: SlashPathTypedFileExtension): Maybe; export declare function mimeTypeForDocumentFileExtension(extension: Maybe): Maybe; /** * Returns the document file extension for the given mimetype, or undefined if the mimetype is not known/recognized. * * @param mimeType The mimetype to get the document file extension for. * @returns The document file extension for the given mimetype, or undefined if the mimetype is not known. */ export declare function documentFileExtensionForMimeType(mimeType: Maybe): Maybe; /** * Non-exhaustive list of common application file extensions. */ export type ApplicationFileExtension = 'zip'; /** * MIME type for ZIP archive files. */ export declare const ZIP_FILE_MIME_TYPE: MimeTypeWithoutParameters; /** * Maps application file extensions to their corresponding MIME types. */ export declare const APPLICATION_FILE_EXTENSION_TO_MIME_TYPES_RECORD: Record; /** * Maps application MIME types back to their corresponding file extensions. */ export declare const APPLICATION_MIME_TYPES_TO_FILE_EXTENSIONS_RECORD: Record; /** * Returns the mimetype for the given application file extension, or undefined if the extension is not known/recognized. * * @param extension The application file extension to get the mimetype for. * @returns The mimetype for the given application file extension, or undefined if the extension is not known. */ export declare function mimeTypeForApplicationFileExtension(extension: ApplicationFileExtension): MimeTypeWithoutParameters; export declare function mimeTypeForApplicationFileExtension(extension: SlashPathTypedFileExtension): Maybe; export declare function mimeTypeForApplicationFileExtension(extension: Maybe): Maybe; /** * Returns the application file extension for the given MIME type, or undefined if the MIME type is not a known application type. * * @param mimeType - the MIME type to look up * @returns the corresponding application file extension, or undefined if not recognized */ export declare function applicationFileExtensionForMimeType(mimeType: Maybe): Maybe; /** * List of known file extensions supported by dbx-components. * * These types are known to work with most dbx-components features related to files. */ export type DbxComponentsKnownFileExtension = ImageFileExtension | DocumentFileExtension | ApplicationFileExtension; /** * Returns the mimetype for the given file extension, or undefined if the extension is not known/recognized. * * @param extension The file extension to get the mimetype for. * @returns The mimetype for the given file extension, or undefined if the extension is not known. */ export declare function mimeTypeForFileExtension(extension: DbxComponentsKnownFileExtension): MimeTypeWithoutParameters; export declare function mimeTypeForFileExtension(extension: SlashPathTypedFileExtension): Maybe; export declare function mimeTypeForFileExtension(extension: Maybe): Maybe; /** * Returns the file extension for the given MIME type by checking image, document, and application types in order. * * @param mimeType - the MIME type to look up * @returns the corresponding file extension, or undefined if the MIME type is not recognized */ export declare function fileExtensionForMimeType(mimeType: Maybe): Maybe; /** * A content disposition string, which is used to determine how the browser should show the target content. * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Disposition */ export type ContentDispositionString = 'inline' | 'attachment' | string;