JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4384
  • Score
    100M100P100Q121018F
  • License MIT

Robustly checks an array of URLs for liveness.

Package Exports

  • check-links

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (check-links) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

check-links

Robustly checks an array of URLs for liveness.

NPM Build Status JavaScript Style Guide

Install

This module requires node >= 4.

npm install --save check-links

Usage

const checkLinks = require('check-links')

const results = await checkLinks([
  'https://foo.com',
  'https://404.com',
])

results['https://foo.com'] // { status: 'alive', statusCode: 200 }
results['https://404.com'] // { status: 'dead', statusCode: 404 }

API

Robustly checks an array of URLs for liveness.

Returns a Map<String, Object> that maps each input URL to an Object with at least one property, status which may be any of alive | dead | error | invalid. Status will be alive if the URL was reachable, dead if it was definitely not reachable, error in the event of repeated transport errors, and invalid if the URL was parsed as invalid.

Additionally, the result LinkCheckResult may contain a statusCode if the HTTP request to that URL resolved properly.

Type: function (urls, opts): Promise

  • urls array<string> Array of urls to test
  • opts object? Configuration options
    • opts.baseUrl string? Base URL for resolving relative urls
    • opts.concurrency number Maximum number of urls to resolve concurrently (optional, default 8)
    • opts.retries number Number of times to retry resolving a dead URL (optional, default 2)
    • opts.protocols Set Set of string protocols to accept (defaults to http: and https:) (optional, default Set(['http:','https:']))

License

MIT © Travis Fischer