Would be cool to have a charset function from mime-types:
const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
const TEXT_TYPE_REGEXP = /^text\//i
export function charset (type) {
if (!type || typeof type !== 'string') return false
const match = EXTRACT_TYPE_REGEXP.exec(type)
const mime = match && db[match[1].toLowerCase()]
if (mime && mime.charset) return mime.charset
// default text/* to utf-8
if (match && TEXT_TYPE_REGEXP.test(match[1])) return 'UTF-8'
return false
}
https://github.com/jshttp/mime-types/blob/c6ff9b224577f0cd49f1155f421b24c24a57bc3e/index.js#L49-L68
Would be cool to have a
charsetfunction from mime-types:https://github.com/jshttp/mime-types/blob/c6ff9b224577f0cd49f1155f421b24c24a57bc3e/index.js#L49-L68