Navigation Menu

Skip to content

StephanGeorg/url-exists-deep

Repository files navigation

url-exists-deep npm version Node CI

A deeper determination if an URL exists.

It tests for:

  • Domain available and accessible
  • Url available and accessible
  • Redirect available and accessible

url-exists-deep was developed for performance and accuracy. To check whether a url exists and is publicly accessible or not a HEAD request is sent, because this is much faster then a GET. Most hosts are responding correct. If the host responses with a 403 Forbidden a GET request with User-Agent and Accept header is sent.

Installation

> npm i url-exists-deep

Usage

import urlExists from 'url-exists-deep';
const url = 'https://www.google.com';
const exists = await urlExists(url);

Result

Returns false if url does not exists or object with url information.

Makes a deeper determination if a url exists or not. To reduce false negative responses.

Rewrites 301

If url redirects with 301 url-exists-deep follows the redirect and returns the destination url if exists.