MSK.SupportModule.MimeTypeDetector 0.0.1

The mime type detector for files.

The mime type detector for files (e.g. png, gif, jpeg, rtf, pdf, docx, zip, rar,...).

Install-Package MSK.SupportModule.MimeTypeDetector -Version 0.0.1
dotnet add package MSK.SupportModule.MimeTypeDetector --version 0.0.1
paket add MSK.SupportModule.MimeTypeDetector --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Mime Type Detector

This is a sub-module of Modular Starter Kit project.
The mime type detector for files (e.g. png, gif, jpeg, rtf, pdf, docx, zip, rar,...) helps to prevent attacker trying to upload or attack damage files to the web server.
Reference to OWASP Top 10 - 2017 for the risks.

Based on https://github.com/Muraad/Mime-Detective

Usage


// Both ways are writing the data to a temp file
// to get a FileInfo. GetFileType are extension methods
byte[] fileData = ...;
FileType fileType = fileData.GetFileType();
   
// or 
Stream fileDataStream = ...;
FileType fileType = fileDataStream.GetFileType();

// If writing to a temp file is not practicable use it like this
byte[] fileData = ...;
FileType fileType = MimeTypes.GetFileType(() => fileData);
   

Mime Type Detector

This is a sub-module of Modular Starter Kit project.
The mime type detector for files (e.g. png, gif, jpeg, rtf, pdf, docx, zip, rar,...) helps to prevent attacker trying to upload or attack damage files to the web server.
Reference to OWASP Top 10 - 2017 for the risks.

Based on https://github.com/Muraad/Mime-Detective

Usage


// Both ways are writing the data to a temp file
// to get a FileInfo. GetFileType are extension methods
byte[] fileData = ...;
FileType fileType = fileData.GetFileType();
   
// or 
Stream fileDataStream = ...;
FileType fileType = fileDataStream.GetFileType();

// If writing to a temp file is not practicable use it like this
byte[] fileData = ...;
FileType fileType = MimeTypes.GetFileType(() => fileData);
   

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
0.0.1 268 3/10/2018