Given a file path, determine the media type.
- Namespace
- Statiq
.Common - Containing Type
- MediaTypes
Syntax
public static bool TryGet(string path, out string mediaType, bool defaultIfNotFound = true)
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | A file path. |
| mediaType | string | The media type. |
| defaultIfNotFound | bool | Will return a "text/x-[extension]" default media type if a mapping is not found. |
Return Value
| Type | Description |
|---|---|
| bool | true if the media type could be determined, false otherwise. |