Table of Contents

TTMSFNCUtils.GetMimeType Method

Returns the MIME type associated with a file name or extension.

API unit family: TMSFNCUtils Declaring type: TTMSFNCUtils

Overloads

Overload 1

Returns the MIME type associated with a file name or extension.

class function GetMimeType(AFile: string): string; overload;

Parameters

Name Description
AFile File name, path, or extension to inspect.

Returns

Matching MIME type, or application/octet-stream when unknown.

Overload 2

Detects the MIME type represented by stream header bytes.

class function GetMimeType(AData: TStream; AResetPosition: Boolean = True): string; overload;

Parameters

Name Description
AData Stream containing file data.
AResetPosition When True, reads from the beginning of the stream; the original position is restored afterward.

Returns

Detected MIME type, or an empty string when no known header is found.