Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 909 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 909 Bytes

Mime

Simple MIME type guesser for .NET and .NET Core.

Install

via NuGet:

PM> Install-Package Mime

Requirements

Supports x64 OS(Linux and Windows). With .NET Framework you need to set platform x64.

Usage

using HeyRed.Mime;

// (Optionally) You can set path to magic database file manually.
MimeGuesser.MagicFilePath = "/path/to/magic/file";

// Guess mime type of file(overloaded method takes byte array or stream as arg.)
MimeGuesser.GuessMimeType("path/to/file") //=> image/jpeg

// Get extension of file(overloaded method takes byte array or stream as arg.)
MimeGuesser.GuessExtension("path/to/file") //=> jpeg

// Get mime type and extension of file(overloaded method takes byte array or stream as arg.)
MimeGuesser.GuessFileType("path/to/file") //=> FileType

Also available extension methods for FileInfo.

License

MIT