Migrate some files types to use `mime.define`
This commit is contained in:
parent
fc3152f819
commit
3d4f50131a
|
@ -1,7 +1,11 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const mime = require('mime')
|
const mime = require('mime')
|
||||||
|
|
||||||
const TextFiles = /\/?(LICENSE|README|CHANGES|AUTHORS|Makefile|\.[a-z]*rc|\.git[a-z]*|\.[a-z]*ignore)$/i
|
const TextFiles = /\/?(\.[a-z]*rc|\.git[a-z]*|\.[a-z]*ignore)$/i
|
||||||
|
|
||||||
|
mime.define({
|
||||||
|
'text/plain': ['license', 'readme', 'changes', 'authors', 'makefile'],
|
||||||
|
})
|
||||||
|
|
||||||
const getContentType = (file) =>
|
const getContentType = (file) =>
|
||||||
TextFiles.test(file) ? 'text/plain' : mime.lookup(file)
|
TextFiles.test(file) ? 'text/plain' : mime.lookup(file)
|
||||||
|
|
Loading…
Reference in New Issue