NetOpWibby / ping

Determine if a URL exists

Home Page:https://npmjs.com/@webb/ping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@webb/ping

Determine if a URL exists

Install

npm i @webb/ping

Usage

import ping from "@webb/ping";

async() => {
  const theLink = await ping("https://example.com");

  if (theLink.exists)
    // do something with it
  else
    // ignore dead links
};

API

ping(input)

input is the URL you want to check, must include protocol prefix (http:///https://).

input

  • Type: String

Tests

# Run all tests, sequentially
$ npm test

# Test dependencies for latest versions
$ npm run test:dependencies

# Lint "src" directory
$ npm run test:typescript

# Test this module
$ npm run test:assert

# Test coverage for the `test:assert` script
$ npm run test:coverage

# Run the included example
$ npm run example

Note

If this module incorrectly reports a live site as not found, that site might be slow to load and/or is configured strangely.

About

Determine if a URL exists

https://npmjs.com/@webb/ping


Languages

Language:TypeScript 100.0%