@shopify/mime-types
MIME type consistency
Last updated 12 days ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/mime-types 
SYNC missed versions from official npm registry.

@shopify/mime-types

Build Status License: MIT npm version npm bundle size (minified + gzip)

MIME type consistency.

Installation

$ yarn add @shopify/mime-types

Usage

This package exposes utilities to dynamically get MIME types from file names and/or get file extensions based on common MIME types.

The types of files currently supported are:

  'image/jpeg',
  'image/png',
  'image/gif',
  'application/pdf',
  'video/mp4',
  'video/quicktime',
  'model/gltf-binary',
  'application/x-mpegURL',

This helps keeping MIME types and file extensions consistent.

getMimeTypeFromFilename

Takes in a file name string and returns a MimeType.

import {getMimeTypeFromFilename} from '@shopify/files';

getMimeTypeFromFilename('image.jpg'); // image/jpeg

getExtensionFromMimeType

Takes in a MimeType and returns a string filename extension that matches the inputted MimeType.

import {getExtensionFromMimeType, MimeType} from '@shopify/files';

getExtensionFromMimeType(MimeType.Pdf); // .pdf

Current Tags

  • 0.1.1                                ...           latest (12 days ago)

3 Versions

  • 0.1.1                                ...           12 days ago
  • 0.1.0                                ...           2 months ago
  • 0.0.1                                ...           2 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 6
Last Month 6
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |