Skip to content

detaybey/MimeBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Badge GitHub Workflow Status (with event) github workflow tests Nuget

MimeBank

MimeBank is a file-type checker for dotnet.

Users upload stuff to your server. You should be checking the file type of the uploaded file. Don't take the file extension for granted. Make sure the JPG is a JPG.

Versions

1.0.2 (legacy)

2.0.0 (netstandard2.1;net6.0)

2.0.1 (netstandard2.1;net6.0;net7.0)

Usage

  MimeChecker mimeChecker = new MimeChecker();
  FileHeader header = mimeChecker.GetFileHeader("PATH_TO_FILE");
  Assert.AreEqual(header.Type, FileType.Image, "File should be an image");
  Assert.AreEqual(header.Extension, "jpg", "File format should be a jpg");
  
  // or simply a boolean check
  var check = MimeChecker.check("PATH_TO_FILE", FileType.EXPECTED_FILE_TYPE); 

NuGet

To install MimeBank, run the following command in the Package Manager Console

PM> Install-Package MimeBank

Thanks

ScottMB (MKV Support)

Zach Meyers (net6.0 Support)

gokceyucel (fixes & additional tests)

SSG (fixes)

License

Apache License 2.0

About

A small file type checker for dotnet

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages