Skip to content

mimeType

The mimeType object links file extensions (without a leading dot) to MIME types through two methods: get and set.

Interactive example

Syntax

typescript
export interface MimeTypeStore {
    get(extensionName: string): string | undefined;
    set(extensionName: string, mimeType: string): void;
}

const mimeType: MimeTypeStore;

Parameters

  • None.

Return value

mimeType is an object of type MimeTypeStore.

  • mimeType.get(extensionName) returns the matching MIME type, or undefined if the extension is unknown.
  • mimeType.set(extensionName, mimeType) adds or updates the MIME type associated with an extension.

See also

Released under the MIT license.