I am having a hard time getting the correct mimetype info without relaying on the file extension / inode data. When using magic it returns with text/plain ever time regardless of what the file is.
For some background information.
When I allow linux mimetype to use glob and its other methods it works correctly.
When I try to have it work with magic checking because i want to really make sure this file is an image it tells me its a text file
mimetype -M mountain.jpg
To make sure its not a text file I will use the file command
file -i mountain.jpg
mountain.jpg: image/jpeg; charset=binary
If i try one of the following I will now only be able to get text/plain.
cat mountain_dew-400-400.jpg | mimetype -M --stdin
tee mountain_dew-400-400.jpg | mimetype -M --stdin
mimetype --stdin - < mountain_dew-400-400.jpg
I have already run the following commands
cpan install IO::Scalar cpan install File::MimeInfo cpan install File::MimeInfo::Magic
mimetype --stdin does not appear to work at all. I’ve submitted Debian bug #784545.
As a workaround you can use
file -i - instead of