JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4380
  • Score
    100M100P100Q121295F
  • License

Simple mime-type map library

Package Exports

  • mimoza

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mimoza) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Mimoza

Build Status

Mimoza is a tiny mime map library. It's a spin-off of the original mime Node module, and happened due to need of some extra features.

Usage overview

var Mimoza = require('mimoza');

// Use builtin mime types:
Mimoza.getExtension('audio/ogg');       // -> '.oga'
Mimoza.getMimeType('ogg');              // -> 'audio/ogg'
Mimoza.getMimeType('.oga');             // -> 'audio/ogg'
Mimoza.getMimeType('test.oga');         // -> 'audio/ogg'
Mimoza.getMimeType('foo/bar.oga');      // -> 'audio/ogg'

// Define your own map
var mime = new Mimoza({
  normalize: function (ext) {
    return '[' + ext.toLowerCase() + ']';
  },
  defaultType: 'hard/core'
});


mime.register('foo/bar', ['baz', 'moo']);
mime.getExtension('foo/bar');           // -> '[baz]'
mime.getMimeType('baz');                // -> 'foo/bar'
mime.getMimeType('[baz]');              // -> 'foo/bar'
mime.getMimeType('tada');               // -> 'hard/core'
mime.getMimeType('tada', 'soft/core');  // -> 'soft/core'

See the API docs for details.