Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Parse URL in Deno

Tags:

deno

urlparse

How do you parse a URL in deno like node.js url.parse()?

like image 326
Timothy C. Quinn Avatar asked Oct 20 '25 04:10

Timothy C. Quinn


1 Answers

No external module is needed to parse URLs in Deno. The URL class is available as a global, just like in your browser:

const urlString = "https://www.google.com";
const url = new URL(urlString);
console.log(`URL: ${url.protocol}//${url.host}`);
like image 123
jsejcksn Avatar answered Oct 22 '25 05:10

jsejcksn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!