MIME type

MIME type

This filter allows you to detect the MIME type of a file and its extension.
Based on the gabriel-vasile/mimetype library.

Parameters

ParameterTypeDefaultDescription
targetSTRING“main”the field of the Message that should be used for the filter (it could be the main or and extra field)
filenameSTRINGemptythe filename of the file to detect (supports Golang templates)
... | mime(target="{{ .extra_field }}") | ...
The filename field override the target. They are mutually exclusive, so you can specify only one of them.

Output

The propagated Message will contain the mimetype’s string in the main field and the extension in the extra field mimetype_ext.

Examples