JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://requirejs.org/docs/release/2.1.2/minified/require.js"></script>
<input id='button' type='file' name='file' />
<div id='out'>Output Goes Here</div>

JavaScript

$('#button').unbind('change');
$('#button').bind('change', function () {
    if (this.files[0] !== undefined && this.files[0] !== null) {
        document.getElementById("out").innerHTML = "Type is " + MimeType.lookup(this.files[0].name);
    } else {
        throw "Error"
    }
});

//
// mimetype.js - A catalog object of mime types based on file extensions
//
// @author: R. S. Doiel, <[email protected]>
// copyright (c) 2012 all rights reserved
//
// Released under New the BSD License.
// See: http://opensource.org/licenses/bsd-license.php
//
(function (self) {
    var path;
    MimeType = {
        charset: 'UTF-8',
        catalog: {},
        lookup: function (fname, include_charset, default_mime_type) {
            var ext, charset = this.charset;
            if (include_charset === undefined) {
                include_charset = false;
            }
            if (typeof include_charset === "string") {
                charset = include_charset;
                include_charset = true;
            }
            if (fname.lastIndexOf('.') > 0) {
                ext = fname.substr(fname.lastIndexOf('.')).toLowerCase();
            } else {
                ext = fname;
            }
            // Handle the special cases where their is no extension
            // e..g README, manifest, LICENSE, TODO
            if (ext == "") {
                ext = fname;
            }
            if (this.catalog[ext] !== undefined) {
                if (include_charset === true && this.catalog[ext].indexOf('text/') === 0 && this.catalog[ext].indexOf('charset') < 0) {
                    return this.catalog[ext] + '; charset=' + charset;
                } else {
                    return this.catalog[ext];
                }
            } else if (default_mime_type !== undefined) {
                if (include_charset === true && default_mime_type.indexOf('text/') === 0) {
                    return default_mime_type + '; charset=' + charset;
                }
               ...