How to use the charsets function from mime-types

Find comprehensive JavaScript mime-types.charsets code examples handpicked from public code repositorys.

129
130
131
132
133
134
135
136
137
138
if(error) return next(error)
if(!body) return next() // 404

var outputType = terraform.helpers.outputType(sourceFile)
var mimeType   = helpers.mimeType(outputType)
var charset    = mime.charsets.lookup(mimeType)
rsp.statusCode = 200
rsp.setHeader('Content-Type', mimeType + (charset ? '; charset=' + charset : ''))
rsp.setHeader('Content-Length', Buffer.byteLength(body, charset));
rsp.end(body)
fork icon373
star icon0
watch icon111