Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xserver/src/deps.ts>media.extensionsByType

X-Server a Deno server module with middleware
Go to Latest
function media.extensionsByType
Re-export
import { media } from "https://deno.land/x/xserver@5.0.0/src/deps.ts";
const { extensionsByType } = media;

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

Example 1

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

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

Parameters

type: string

Returns

string[] | undefined