Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
function extensionsByType
import { extensionsByType } from "";

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 ..


Example 1

import { extensionsByType } from "";

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


type: string


string[] | undefined