Usage in Deno
import * as mod from "node:url";
The node:url
module provides utilities for URL resolution and parsing. It can
be accessed using:
import url from 'node:url';
Browser-compatible URL
class, implemented by following the WHATWG URLStandard. Examples of parsed URLs may be found in the Standard itself.The URL
class is also available on the global object.
The URLSearchParams
API provides read and write access to the query of a URL
. The URLSearchParams
class can also be used standalone with one of thefour following constructors.The URLSearchParams
class is also available on the global object.
Returns the Punycode ASCII serialization of the domain
. If domain
is aninvalid domain, the empty string is returned.
Returns the Unicode serialization of the domain
. If domain
is an invaliddomain, the empty string is returned.
This function ensures the correct decodings of percent-encoded characters aswell as ensuring a cross-platform valid absolute path string.
The url.format()
method returns a formatted URL string derived from urlObject
.
This function ensures that path
is resolved absolutely, and that the URLcontrol characters are correctly encoded when converting into a File URL.
The url.resolve()
method resolves a target URL relative to a base URL in amanner similar to that of a web browser resolving an anchor tag.
This utility function converts a URL object into an ordinary options object asexpected by the http.request()
and https.request()
APIs.