hey-red / Mime

.NET wrapper for libmagic
MIT License
84 stars 22 forks source link

Add Additional Info #16

Closed TheYarin closed 7 years ago

TheYarin commented 7 years ago

the linux file command returns more information about the file type, it's encoding, endians, sometimes even a description. It would be nice to have that data available too, assuming that kind of data is present in the magic.mgc file.

Also, I just wanted to say, thank you so much for making this project, after a few days of banging my head against the wall I found it and it looks promising!

hey-red commented 7 years ago

You can use Magic class directly(MimeGuesser it's just static facade for this class). For example:

using (var magic = new Magic(
        MagicOpenFlags.MAGIC_MIME_TYPE |
        MagicOpenFlags.MAGIC_MIME_ENCODING, 
        null))
 {
        Console.WriteLine(magic.Read("/path/to/file"));
 }

see magic flags for more.

TheYarin commented 7 years ago

Silly me, I didn't notice that. I think this should be added to the examples in the README.