How to use mime.extension:
GitHub: rizkihdyt6/bot-vps
196 197 198 199 200 201 202 203 204 205 206 207 208
} /** GENERATE FILENAME WHEN NOT AVAILABLE **/ function constructFilename(msg) { return "upload." + mime.extension(msg.file.mime); } /** AGENT **/
How to use mime.define:
GitHub: broofa/mime

148 149 150 151 152 153 154 155 156 157
mime.getExtension('text/plain'); // ⇨ 'txt' mime.getExtension('application/json'); // ⇨ 'json' mime.getExtension('text/html; charset=utf8'); // ⇨ 'html' ``` ### mime.define(typeMap[, force = false]) Define [more] type mappings. `typeMap` is a map of type -> extensions, as documented in `new Mime`, above.
See more examples
How to use mime.charsets:
831 832 833 834 835 836 837 838 839 840 841 842
if (!type) { debug('no content-type') return } var charset = mime.charsets.lookup(type) debug('content-type %s', type) res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')) }
How to use mime.getExtension:
GitHub: broofa/mime

138 139 140 141 142 143 144 145 146 147
```javascript mime.getType('foo/txt'); // ⇨ null mime.getType('bogus_type'); // ⇨ null ``` ### mime.getExtension(type) Get extension for the given mime type. Charset options (often included in Content-Type headers) are ignored. ```javascript
See more examples
How to use mime.lookup:
GitHub: tj/nshell

187 188 189 190 191 192 193 194 195 196
// auto-editor (silly implementation) shell.on('command', function(e){ var line = e.line.trim(); var type = mime.lookup(line); switch (type) { case 'text/plain': case 'text/css': case 'application/javascript':
See more examples
How to use mime.getType:
GitHub: silexlabs/unifile

15 16 17 18 19 20 21 22 23 24
return { size: stat.size, modified: stat.mtime, name: filename, isDir: isDir, mime: isDir ? 'application/directory' : Mime.getType(filename) }; } /**
See more examples