npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jthrilly/dead-link-checker

v1.0.6

Published

A simple tool to check for dead links in a website

Downloads

342

Readme

Dead Link Checker

A simple and efficient Node.js script to recursively check for dead links on a webpage. This script validates both internal and external links, with configurable concurrency and delay to control the load on servers.

Features

  • Recursive Link Checking: Crawls and checks all links on the given webpage, including internal and external links.
  • Concurrency Control: Configure the number of simultaneous requests for faster or slower processing.
  • Delay Between Requests: Add delays between requests to avoid overwhelming servers.
  • Verbose Output: View detailed information about each link checked.
  • Excludes Non-HTTP Links: Skips invalid URLs like mailto:, javascript:, and fragment links (#section).

Requirements

  • Node.js 20.x or later

Installation

No need to install - just call directly from your github action or CLI using npx:

npx dead-link-checker <URL> [options]

Options

  • -v: Enable verbose mode. Displays all checked links and their status codes.
  • --concurrent=<number>: Set the number of concurrent requests (default: 20).
  • --delay=<milliseconds>: Set the delay between requests in milliseconds (default: 10).

Excluded Links

The script skips the following types of links:

  • mailto: email links
  • javascript: links
  • Empty links (<a href=""></a>)
  • Fragment-only links (<a href="#section"></a>)

How It Works

  1. The script fetches the provided URL and parses all links using the JSDOM library.
  2. Each link is validated using the Node.js fetch API.
  3. Internal links are recursively added to the queue for further checking.
  4. External links are checked only once and not followed recursively.
  5. Links with errors (e.g., 404 Not Found) are reported in the summary.

License

This script is released under the MIT License. Feel free to modify and use it as you see fit.

Author

Developed by Joshua Melville (jthrilly) using Claude and ChatGPT.