Class MimeTypes
- Namespace
- CSF.Screenplay.Reporting
- Assembly
- CSF.Screenplay.dll
Provides utilities for mapping file names and extensions to MIME-types.
public static class MimeTypes
- Inheritance
-
MimeTypes
- Inherited Members
Remarks
Note that this file was copied directly from the source code for the MimeTypes package. I had tried to include it via NuGet in the past but the mechanism seems to be incompatible with SonarScanner. As such I have abandoned including it via NuGet and I'm switching to including the file manually. Obviously, to upgrade this package, I will need to re-download and include this file again.
Properties
FallbackMimeType
The fallback MIME-type. Defaults to application/octet-stream.
public static string FallbackMimeType { get; set; }
Property Value
Methods
GetMimeType(string)
Gets the MIME-type for the given file name, or FallbackMimeType if a mapping doesn't exist.
public static string GetMimeType(string fileName)
Parameters
fileNamestringThe name of the file.
Returns
- string
The MIME-type for the given file name.
GetMimeTypeExtensions(string)
Attempts to fetch all available file extensions for a MIME-type.
public static IEnumerable<string> GetMimeTypeExtensions(string mimeType)
Parameters
mimeTypestringThe name of the MIME-type
Returns
- IEnumerable<string>
All available extensions for the given MIME-type
TryGetMimeType(string, out string)
Tries to get the MIME-type for the given file name.
public static bool TryGetMimeType(string fileName, out string mimeType)
Parameters
Returns
- bool
trueif a MIME-type was found,falseotherwise.