std.mime.mime_type

std.mime

mime_type(filename) -> mime

Detect the MIME type of a file based on its extension

The match ignores the case of the extension: CLIP.MP4 is video/mp4. A name with no extension, or an unknown one, gives application/octet-stream.