Skip to main content
Module

std/url/mod.ts

Deno standard library
Latest
import * as mod from "https://deno.land/std@0.218.2/url/mod.ts";

Utilities for working with URL paths.

This module is browser compatible.

Functions

Return the last portion of a URL, or the host name if there is no path. Trailing /s are ignored, and optional suffix is removed.

Return the directory path of a URL. A directory path is the portion of a URL up to but excluding the final path segment. The final path segment, along with any query or hash values are removed. If there is no path segment then the URL origin is returned. Example, for the URL https://deno.land/std/path/mod.ts, the directory path is https://deno.land/std/path.

Return the extension of the URL with leading period. The extension is sourced from the path portion of the URL. If there is no extension, an empty string is returned.

Join a base URL and a series of paths, then normalizes the resulting URL.

Normalize the URL, resolving '..' and '.' segments and multiple '/'s into '//' after protocol and remaining into '/'.