Skip to content

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 | undefined

Export

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 SupportedExtensionFile

Exported types

  • SupportedMimeType
  • SupportedExtensionFile

Notes

  • Extensions are without a dot (e.g., "png"). Some entries include a "*" prefix as defined in the database.

See also

Released under the MIT license.