Link-exists
A super lightweight JavaScript / TypeScript library to check whether a given url is valid and exists or not.
npm install link-exists
A super lightweight library to validate if a given url is valid or not. Some additional features are-
import { linkExists } from 'link-exists';
const result = await linkExists('https://stackblogger.com');
console.log(result);
// OUTPUT true
const result = await linkExists('https://some-invalid-url.com');
console.log(result);
// OUTPUT false
const result = await linkExists('stackblogger.com');
console.log(result);
// OUTPUT false
// Configuration
const result = await linkExists('stackblogger.com', { ignoreProtocol: true });
console.log(result);
// OUTPUT true
const { linkExists } = require('link-exists');
const result = await linkExists('https://stackblogger.com');
console.log(result);
// OUTPUT true
const result = await linkExists('https://some-invalid-url.com');
console.log(result);
// OUTPUT false
const result = await linkExists('stackblogger.com');
console.log(result);
// OUTPUT false
// Configuration
const result = await linkExists('stackblogger.com', { ignoreProtocol: true });
console.log(result);
// OUTPUT true
Author: stackblogger
Source Code: https://github.com/stackblogger/link-exists
License: MIT