@amiya_ranjan/valid_url
v1.0.4
Published
This is the npm module for checking if a url exists or not
Downloads
7
Readme
URL Validator
URL Validator is a simple npm package that allows you to validate URLs and check if they have genuine DNS using the DNS lookup functionality.
Installation
You can install the URL Validator package via npm:
npm i @amiya_ranjan/valid_url
Usage
const { validateURL } = require("@amiya_ranjan/valid_url");
const urls = ["https://www.google.com", "https://invalidurl", ""];
urls.forEach(async (url) => {
try {
const isValid = await validateURL(url);
console.log(`${url}: ${isValid ? "Valid" : "Invalid"}`);
} catch (error) {
console.error(`${url}: ${error.message}`);
}
});
It will return true if URL is valid and DNS lookup went successful otherwise it will return an error