TelegramEx.MimeType (TelegramEx v1.3.0)

Copy Markdown View Source

Resolves MIME content types for local files based on their extension.

This is used by the file-based builders (Photo, Video, Voice, Sticker, Document) so that uploaded media carries the correct Content-Type header instead of a hardcoded value.

Summary

Functions

Returns the fallback MIME content type used for unknown extensions.

Returns the MIME content type for the given file path.

Functions

default()

@spec default() :: String.t()

Returns the fallback MIME content type used for unknown extensions.

from_path(path)

@spec from_path(String.t()) :: String.t()

Returns the MIME content type for the given file path.

The lookup is based on the lowercased file extension. Unknown extensions fall back to application/octet-stream.

Parameters

  • path - Path or filename of the file

Returns

A MIME content type string.