Sudoo-Mimetype

Continuous Integration codecov npm version downloads

Mimetype Handler

Install

yarn add @sudoo/mimetype
# Or
npm install @sudoo/mimetype --save

Usage

This package provide multiple mimetype collections.
Match mimetype by extension name with the following code.

import { allMediaType } from "@sudoo/mimetype";
allMediaType.matchFirstAvailableMimeType('.jpg'); // image/jpeg

videoMediaType, imageMediaType, textMediaType, multiMediaType are also provided from the package.

Create another Media type and other features are also easy, see source code for more details.