3 This module has utilities for URL resolution and parsing.
4 Call `require('url')` to use it.
6 Parsed URL objects have some or all of the following fields, depending on
7 whether or not they exist in the URL string. Any parts that are not in the URL
8 string will not be in the parsed object. Examples are shown for the URL
10 `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
12 * `href`: The full URL that was originally parsed.
14 Example: `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'`
15 * `protocol`: The request protocol.
18 * `host`: The full host portion of the URL, including port and authentication information.
20 Example: `'user:pass@host.com:8080'`
21 * `auth`: The authentication information portion of a URL.
23 Example: `'user:pass'`
24 * `hostname`: Just the hostname portion of the host.
27 * `port`: The port number portion of the host.
30 * `pathname`: The path section of the URL, that comes after the host and before the query, including the initial slash if present.
33 * `search`: The 'query string' portion of the URL, including the leading question mark.
35 Example: `'?query=string'`
36 * `query`: Either the 'params' portion of the query string, or a querystring-parsed object.
38 Example: `'query=string'` or `{'query':'string'}`
39 * `hash`: The 'fragment' portion of the URL including the pound-sign.
43 The following methods are provided by the URL module:
45 ### url.parse(urlStr, parseQueryString=false)
47 Take a URL string, and return an object. Pass `true` as the second argument to also parse
48 the query string using the `querystring` module.
50 ### url.format(urlObj)
52 Take a parsed URL object, and return a formatted URL string.
54 ### url.resolve(from, to)
56 Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.