Skip to main content
Module

x/lume/deps/media_types.ts>extensionsByType

🔥 Static site generator for Deno 🦕
Very Popular
Go to Latest
function extensionsByType
import { extensionsByType } from "https://deno.land/x/lume@v1.13.2/deps/media_types.ts";

Returns the extensions known to be associated with the media type type. The returned extensions will each begin with a leading dot, as in .html.

When type has no associated extensions, the function returns undefined.

Extensions are returned without a leading ..

Examples

import { extensionsByType } from "https://deno.land/std@0.224.0/media_types/mod.ts";

extensionsByType("application/json"); // ["js", "mjs"]
extensionsByType("text/html; charset=UTF-8"); // ["html", "htm", "shtml"]
extensionsByType("application/foo"); // undefined

Parameters

type: string

Returns

string[] | undefined