Skip to content

kumo.file_type.from_extension

local ft_list = kumo.file_type.from_extension(EXT)
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 filename extension.

This function will return an array style table holding one entry for each file type that has the specified filename extension.

Each element of the array is a FileTypeResult.

local kumo = require 'kumo'
local utils = require 'policy-extras.policy_utils'

local markdown = kumo.file_type.from_extension 'markdown'
utils.assert_eq(markdown, {
  {
    name = 'Q1193600',
    media_types = {
      'text/markdown',
    },
    extensions = {
      'markdown',
      'md',
      'mdown',
      'mdtext',
      'mdtxt',
      'mkd',
    },
  },
})