mimeType
MIME type and supported extension utilities.
WARNING
If you have extensions or MIME types that are not supported, you can override the mimeType Map to add them.
Example
ts
import { SF } from "@duplojs/server-utils";
const isSupported = SF.isSupportedExtensionFile("png");
// isSupported: boolean
const mime = SF.mimeType.get("png");
// mime: SF.SupportedMimeType | undefinedExport
Map mimeType
mimeType is a Map that associates a file extension with a supported MIME type.
typescript
const mimeType: Map<string, SupportedMimeType>;Function isSupportedExtensionFile
typescript
function isSupportedExtensionFile(
input: string
): input is SupportedExtensionFileExported types
SupportedMimeTypeSupportedExtensionFile
Notes
- Extensions are without a dot (e.g.,
"png"). Some entries include a"*"prefix as defined in the database.
See also
fileInterface- Creates a file interface.
