Package-level declarations

Types

Link copied to clipboard
sealed external interface FileUrlToPathOptions
Link copied to clipboard
sealed external interface PathToFileUrlOptions
Link copied to clipboard
sealed external interface Url
Link copied to clipboard
sealed external interface URLFormatOptions
Link copied to clipboard
sealed external interface UrlObject
Link copied to clipboard
sealed external interface UrlWithParsedQuery : Url
Link copied to clipboard
sealed external interface UrlWithStringQuery : Url

Functions

Link copied to clipboard
external fun domainToASCII(domain: String): String

Returns the Punycode ASCII serialization of the domain. If domain is an invalid domain, the empty string is returned.

Link copied to clipboard
external fun domainToUnicode(domain: String): String

Returns the Unicode serialization of the domain. If domain is an invalid domain, the empty string is returned.

Link copied to clipboard
external fun fileURLToPath(url: String, options: FileUrlToPathOptions = definedExternally): String
external fun fileURLToPath(url: URL, options: FileUrlToPathOptions = definedExternally): String

This function ensures the correct decodings of percent-encoded characters as well as ensuring a cross-platform valid absolute path string.

Link copied to clipboard
external fun format(urlObject: String): String
external fun format(urlObject: UrlObject): String
external fun format(urlObject: URL, options: URLFormatOptions = definedExternally): String

The url.format() method returns a formatted URL string derived from urlObject.

Link copied to clipboard
external fun parse(urlString: String): UrlWithStringQuery

The url.parse() method takes a URL string, parses it, and returns a URL object.

external fun parse(urlString: String, parseQueryString: Boolean, slashesDenoteHost: Boolean = definedExternally): Url
Link copied to clipboard
external fun pathToFileURL(path: String, options: PathToFileUrlOptions = definedExternally): URL

This function ensures that path is resolved absolutely, and that the URL control characters are correctly encoded when converting into a File URL.

Link copied to clipboard
external fun resolve(from: String, to: String): String

The url.resolve() method resolves a target URL relative to a base URL in a manner similar to that of a web browser resolving an anchor tag.

Link copied to clipboard

This utility function converts a URL object into an ordinary options object as expected by the http.request() and https.request() APIs.