How to use the mime.extensions function in mime

To help you get started, we’ve selected a few mime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apla / dataflo.ws / task / mime.js View on Github external
_onResult: function (err, mimeType) {
		if (err) {
			this.failed(err);
		} else {
			this.completed({
				type: mimeType,
				extension: mime.extensions[mimeType] ||
					mime.extensions[DEFAULT_TYPE]
			});
		}
	},
github apla / dataflo.ws / task / mime.js View on Github external
_onResult: function (err, mimeType) {
		if (err) {
			this.failed(err);
		} else {
			this.completed({
				type: mimeType,
				extension: mime.extensions[mimeType] ||
					mime.extensions[DEFAULT_TYPE]
			});
		}
	},
github IonicaBizau / statique / lib / index.js View on Github external
Statique.prototype.sendRes = function (res, statusCode, mimeType, content, otherHeaders) {

    var self = this
      , lMimeType = null
      ;

    if (Mime.extensions[lMimeType = Mime.lookup(String(mimeType))] === mimeType) {
        mimeType = lMimeType;
    }

    var headers = {
        "Content-Type": mimeType || "plain/text"
      , "Server": "Statique Server"
    };

    for (var h in otherHeaders) {
        headers[h] = otherHeaders[h] === undefined ? headers[h] : otherHeaders[h];
    }

    res.writeHead(statusCode, headers);

    if (typeof content === "string" || content instanceof Buffer) {
        res.end(content);