import { extname } from "https://deno.land/std@0.224.0/url/mod.ts";
Returns the file extension of a given URL or string with leading period.
The extension is sourced from the path portion of the URL. If there is no extension, an empty string is returned.
Examples
Basic usage
Basic usage
import { extname } from "https://deno.land/std@0.224.0/url/extname.ts";
extname("https://deno.land/std/path/mod.ts"); // ".ts"
extname("https://deno.land/std/path/mod"); // ""
extname("https://deno.land/std/path/mod.ts?a=b"); // ".ts"
extname("https://deno.land/"); // ""
Parameters
url: string | URL
The URL from which to extract the extension.