For Node applications, there is a more up-to-date answer now, which is to use the mime-types NPM package, e.g.:
var mime = require('mime-types'),
fileExtension = mime.extension('text/plain');
For Node applications, there is a more up-to-date answer now, which is to use the mime-types NPM package, e.g.:
var mime = require('mime-types'),
fileExtension = mime.extension('text/plain');