URLs.parse()

Parse metadata from a URL.

Usage

Hover over inputs/exits for more info.

var URLs = require('machinepack-urls');


// Parse metadata from a URL.

URLs.parse({

url: 'http://user:pass@host.com:8080/p/a/t/h?query=string#hash',

}).execSync();

Inputs

url required

The URL to parse.

'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'

Exits

error

An unexpected error occurred.

success

OK.

{ protocol: 'http:',
  auth: 'user:pass',
  port: 8080,
  hostname: 'host.com',
  hash: 'hash',
  search: '?query=string',
  pathname: '/p/a/t/h',
  path: '/p/a/t/h?query=string' }