node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

metalsmith-mime-type

metalsmith-mime-type

nodei.co

npm

github-issues

stars

forks

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.

License