Variable mimeConst

mime: {
    getFileExtension: ((filename) => string);
    lookup: ((filename) => string);
    lookupFromFile: ((file) => string);
} = ...

Universal MIME type utility object with methods similar to mime-types package

Type declaration

  • getFileExtension: ((filename) => string)
      • (filename): string
      • Gets the file extension from a filename or file path

        Parameters

        • filename: string

          The filename or path

        Returns string

        The file extension including the dot (e.g., '.jpg')

  • lookup: ((filename) => string)
      • (filename): string
      • Universal MIME type lookup that works in both Node.js and browser environments

        Parameters

        • filename: string

          The filename or path to get MIME type for

        Returns string

        The MIME type string, or 'application/octet-stream' as fallback

  • lookupFromFile: ((file) => string)
      • (file): string
      • Gets MIME type from a File object (browser environment only)

        Parameters

        • file: File

          The File object

        Returns string

        The MIME type from the file object, or lookup from filename as fallback