The FindMimeFromData method accessible through Windows DLL Urlmon.dll
is capable of determining the MIME type of a given data stored in memory, considering the
There are multiple possible solutions in this SO post which will at the very least give you some food for thought.
It seems that the only real way to do it is to read it in binary and then do a comparison, whether the MIME Types are declared hard-coded in some fashion or you rely on the machines own available MIME Types / Registry.