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
external class URLPattern
Link copied to clipboard
sealed external interface URLPatternComponentResult
Link copied to clipboard
sealed external interface URLPatternInit
Link copied to clipboard
sealed external interface URLPatternOptions
Link copied to clipboard
sealed external interface URLPatternResult
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: ERROR CLASS: Symbol not found for URL, options: FileUrlToPathOptions = definedExternally): String
external fun fileURLToPath(url: String, 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 fileURLToPathBuffer(url: ERROR CLASS: Symbol not found for URL, options: FileUrlToPathOptions = definedExternally): Buffer<*>
external fun fileURLToPathBuffer(url: String, options: FileUrlToPathOptions = definedExternally): Buffer<*>

Like url.fileURLToPath(...) except that instead of returning a string representation of the path, a Buffer is returned. This conversion is helpful when the input URL contains percent-encoded segments that are not valid UTF-8 / Unicode sequences.

Link copied to clipboard
external fun format(urlObject: String): String
external fun format(urlObject: UrlObject): String
external fun format(urlObject: ERROR CLASS: Symbol not found for 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): ERROR CLASS: Symbol not found for 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
external fun urlToHttpOptions(url: ERROR CLASS: Symbol not found for URL): ClientRequestArgs

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