kumo.file_type.from_media_type
Since: Dev Builds Only
The functionality described in this section requires a dev build of KumoMTA. You can obtain a dev build by following the instructions in the Installation section.
Returns the list of file types that have the specified MIME media type.
This function will return an array style table holding one entry for each file type that has the specified media type.
Each element of the array is a FileTypeResult.
local kumo = require 'kumo'
local utils = require 'policy-extras.policy_utils'
local png = kumo.file_type.from_media_type 'image/png'
-- Note that we're just looking at the first element of
-- the returned array here; there are a number of entries
-- returned for this media type
utils.assert_eq(png[1], {
name = 'Portable Network Graphics',
media_types = { 'image/png' },
extensions = { 'png' },
})