2.0.0 • Published 4 years ago

mime-wrapper v2.0.0

Weekly downloads
351
License
MIT
Repository
github
Last release
4 years ago

Information

Since version 2.4.3 of the mime package, this wrapper is not needed anymore. Now you can use it directly with Angular. See this issue.

mime-wrapper

This is a wrapper for the node-mime module by broofa. It allows you to use node-mime with Angular-CLI projects.

Install

$ npm install mime-wrapper mime

Usage

In Angular:

import { mimeTypes } from "mime-wrapper";

mimeTypes.getType("file.png");
mimeTypes.getExtension("text/plain");

Why

If you use the module node-mime in Angular-CLI Projects version 6, you will see this error:

ERROR in ./node_modules/mime/index.js Module not found: Error: Can't resolve './types/other' in '/www/mime-type-ng/node_modules/mime' ERROR in ./node_modules/mime/index.js Module not found: Error: Can't resolve './types/standard' in '/www/mime-type-ng/node_modules/mime'

In Angular-CLI projects you cannot modify the webpack config to resolve other extensions than ".js" and ".ts". This package fixes this, without the need of ng eject.

Thanks

Thanks to pfeigl. (issue)