TonyValenti / Mime-Detective-clarkis117

Mime type detector for files, byte arrays, and streams, .NET Standard Fork
MIT License
38 stars 9 forks source link

MimeDetective LearnMimeType reads every other byte of a header #34

Open pluggles opened 5 years ago

pluggles commented 5 years ago

It appears thatpublic static FileType LearnMimeType(FileInfo first, FileInfo second, string mimeType, int maxHeaderSize = 12, int minMatches = 2, int maxNonMatch = 3) in MimeDetective.cs is checking every other byte for matches in this method and adds the matches to the header for the new file type it returns.

Is this intentional?

Additionally i'm having a hard time figuring out the purpose of this method at all. Is it used to find the common header info of a known filetype/mime extension, or is it used to find the mime type of an unknown file, by comparing it to a known mime type? or something else