metalsmith-mime-type
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
install
npm i --save metalsmith-mime-type
usage
mimeType = require('metalsmith-mime-type')
metalsmith(__dirname)
.use(mimeType(['**/*','!*.jpg']))
.build(callback)
options
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.
compatibility
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')
Author
Levi Wheatcroft levi@wht.cr
Contributing
Contributions welcome; Please submit all pull requests against the master branch.