links-awakening
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Photo of Link waking up

Links Awakening

Recursively check a website for broken links.

Usage

npx links-awakening 'https://styfle.dev'

Output

✅ https://styfle.dev/
✅ https://styfle.dev/projects
✅ https://styfle.dev/blog
✅ https://styfle.dev/contact
✅ https://twitter.com/styfle
✅ https://keybase.io/styfle
✅ https://github.com/styfle
✅ https://www.npmjs.com/~styfle
✅ https://styfle.dev/blog/copee-released
✅ http://googlechromereleases.blogspot.com/
✅ https://developers.google.com/web/updates/
✅ https://developers.google.com/web/updates/2015/04/cut-and-copy-commands
❌ http://zeroclipboard.org/ (status: 500, referer: https://styfle.dev/blog/copee-released)
✅ http://styfle.github.io/copee/
✅ https://styfle.dev/blog/d3js-graph-prod
❌ https://styfle.dev/slides/d3js.html (status: 404, referer: https://styfle.dev/blog/d3js-graph-prod)

Programmatic API

import { awaken, type AwakenResult } from 'links-awakening';

const onAwaken = ({ url, status }: AwakenResult) => {
  const icon = status >= 200 && status <= 299 ? '✅' : '❌';
  console.log(`${icon} ${url}`);
};

const url = new URL('https://example.com/blog');

const results = new Map<string, AwakenResult>();

await awaken({ url, onAwaken, results });

console.log(`Done! Crawled ${results.size} links.`);

Readme

Keywords

none

Package Sidebar

Install

npm i links-awakening

Weekly Downloads

4

Version

1.0.3

License

none

Unpacked Size

5.79 kB

Total Files

6

Last publish

Collaborators

  • styfle