MimeDetect is a library that used to identify MIME content type by analysing the file binary header with optional file extension. For .NET Framework version package has fallback into urlmon.dll (Windows systems only).
This package is part of nonexisting project Winista.
Install-Package Winista.MimeDetect
dotnet add package Winista.MimeDetect
//init
var mimeTypes = new MimeTypes();
//usage by filepath
var mimeType1 = mimeTypes.GetMimeTypeFromFile(filePath);
//usage by bytearray
var mimeType2 = mimeTypes.GetMimeTypeFromFile(bytes);