DEV Community

Matěj Štágl
Matěj Štágl

Posted on

MimeTypeCore - 2,000+ MIME/extensions pairs + header bytes collision resolution

All the MIME/file extension pairs you will ever need. Comes with optional, magic bytes-based collision resolution:

https://github.com/lofcz/MimeTypeCore

Features:

  • MIT licensed with no extra bs, unlike Mime Detective; online demo included.
  • Works on anything from .NET 4 to the newest .NET Core, .netstandard 1.2 is supported too. When using newer runtimes, the library utilizes some perf/qol niceties (Span, FileStream, FrozenDictionary..)
  • 2,000+ MIME/file extensions pairs (double that of MimeTypeMap), get one from the other, even without having a Stream. Sourced from IANA and other authoritative sources.
  • If you have a Stream, pass it along and get the file header sampled if needed (for example, .ts can be either a TypeScript file or a Transport Stream MPEG video).
  • Available on NuGet now as MimeTypeCore.
  • Integrations for Blazor Server, WASM, MVC.
  • Development tooling included to ease merging of contributions, including utils like Formatter, Inserter, Generator, and GitHub actions CI/CD.
  • NUnit tested.

Top comments (0)