Skip to main content


Deno standard library
Go to Latest
import * as mod from "";

Utilities for working with URL paths.

This module is browser compatible.


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, the directory path is

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