Content-Type cannot be detected from a text/plain file
mytharcher opened this issue · 1 comments
mytharcher commented
I have a text/plain
file a.txt
which contains only a string as hello world!
. But the fileType
function only got null
result for this file. Not sure if it is a bug from file-type@^3.x
(and latest is @17.x).
Maybe 2 ways could solve:
- Use the file stream's own
mimetype
if exists. - Upgrade package
file-type
's version to latest and test.
LinusU commented
This is not supported by file-type
, and probably won't be: sindresorhus/file-type#55
You can provide a custom function that e.g. falls back to the browser reported file type, but I don't think that we should change the default to that since there is no guarantee that the uploaded file actually is text just because the header said so.
https://github.com/anacronw/multer-s3#setting-custom-content-type