x/oak/deps.ts

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Very Popular
Go to Latest
function extension
import { extension } from "https://dotland-vbqsvsrpfncg.deno-staging.dev/x/oak@v11.1.0/deps.ts?s=extension";

For a given media type, return the most relevant extension, or undefined if no extension can be found.

Extensions are returned without a leading ..

Examples

import { extension } from "https://deno.land/std@$STD_VERSION/media_types/mod.ts";

extension("text/plain"); // `txt`
extension("application/json"); // `json`
extension("text/html; charset=UTF-8"); // `html`
extension("application/foo"); // undefined

Parameters

type: string[src]

Returns

string | undefined[src]