Parse a URL, get one or all components pretty-printed or as JSON. Uses whatwg-url
underneath.
Note: This utility has been rewritten in Rust, checkout url-parser-cli.
npm install -g parse-url-cli
Or use npx
. ✨
Usage:
parse-url <url> [component]
Options:
--json -j Output JSON instead of a pretty represenation.
Examples:
parse-url 'https://example.org:2000/hello/world?foo=bar#baz' host
parse-url --json 'example.org:2000'
Pro tip: Use query-string-cli
in conjunction with parse-url-cli
.
-
curl's
trurl
– Command line tool for URL parsing and manipulation. -
url-decode-encode-cli
– Command line utility for URL decoding & encoding. -
query-string-cli
– Decode & encode URL query strings in the command line. -
whatwg-url
– An implementation of the WHATWG URL Standard in JavaScript
If you have a question or have difficulties using parse-url-cli
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.