Closed laurent22 closed 1 week ago
I guess the best package to do that would be file-type, it has a lot of downloads, has only 4 dependencies (and each one has at most 2 dependencies), a pretty extensive list of formats.
Would be interesting to think what are the most common type of format that should be supported, I guess most of the times it will PDF or a document file like Microsfot Word/Excel (which is supported by the package, excluding older versions) and .odf/.ods (Libre/OpenOffice, etc).
Would be interesting to think what are the most common type of format that should be supported
In my case it's mostly PDF and images. The "file-type" package covers them.
In general, it can be any type. So personally, I would like another differentiation between:
application/octet-stream
text/plain
, just to avoid having application/octet-stream
assigned to themI'm not sure how much effort a robust implementation in JS would require, though. Maybe some package, like isutf8 could be used.
Currently, when calling
POST /resources
, only the mime type of images is automatically detected. PDF for example are not detected, unless they end with the ".pdf" extension.We should investigate whether we can automatically detect the mime type based on the file signature (there's probably an npm package for this). If the imported package is not too large that would be the preferred solution.