const url = require('url'); const myURL = url.parse('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash');