NET library for detecting file type / mime

I need a NET name type library (100% best) with similar TrIDEngine functionality . Ultimately, I would have to pass in the Streamrepresenting content and expect the return value to be either a MIME type or some enumeration / string that is easily matched to a MIME type.

I want to detect only a few types of media, such as WMV, WAV, MP3, and common image formats such as JPEG, PNG, GIF and BMP.

The problem with TrIDEngine is that it only appears as a command-line utility and expects the physical path to the file, not the required one Stream.

+5
source share
1 answer

If you just need to detect several types of files, you can find them on Wikipedia and check the bytes themselves or the "magic" bytes. You can usually determine the file type from the first few bytes so that you can read several bytes from the stream and check them yourself. Not quite what you ask for, but it should not be too complicated for just a few types.

+1
source

All Articles