metalsmith plugin to determine mime type from file contents
metalsmith plugin to detect mime types from file contents
This plugin is a thin wrapper around mmmagic which inspects the contents of files to determine mime type rather than simply looking up the file extension
Take a look at the annotated source
npm i --save metalsmith-mime-type
mimeType = require('metalsmith-mime-type')metalsmith(__dirname).use(mimeType(['**/*','!*.jpg'])).build(callback)
A single option,
src is used as a minimatch mask to determine what files
need to to have mimetypes assigned. can be passed in as an object property,
or as a string. See usage example.
dist/index.js is fully compatible with Node 6.3.1
dist/node4/index.js is fully compatible with Node 4 LTS, require it like so:
var mimeType = require('metalsmith-mime-type/dist/node4')
Levi Wheatcroft email@example.com
Contributions welcome; Please submit all pull requests against the master branch.