New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

link-exists

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

link-exists

A super lightweight JavaScript / TypeScript library to check whether a given url is valid and exists or not.

1.2.2
latest
Source
npm
Version published
Weekly downloads
11K
0.72%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub Workflow Status (branch) npm npm npm bundle size GitHub

A super lightweight JavaScript / TypeScript library to check whether a given url is valid and exists or not.

Installation

npm install link-exists

Features

A super lightweight library to validate if a given url is valid or not. Some additional features are-

  • less than 1 kb in size
  • additional configuration to validate as per custom requirement
  • supports node.js latest version
  • TypeScript and JavaScript support
  • built on ES6 modules
  • Jest test cases with 100% coverage
  • Promise based result

Usage (TypeScript)

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

Usage (JavaScript)

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

License

MIT

Keywords

link-exists

FAQs

Package last updated on 23 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts