Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ using MimeTypes;
### Getting the mime type to an extension

```cs
Console.WriteLine("txt -> " + MimeTypeMap.GetMimeType("txt")); // "text/plain"
var fileName = "test.txt";
var ext = Path.GetExtension(fileName); // .txt
Console.WriteLine("txt -> " + MimeTypeMap.GetMimeType(ext)); // "text/plain"
```

Pass in a string extension and get a mime type back. Optionally include the period. If not it will be added before looking up the mime type.
Expand Down