JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q30737F
  • License AGPL-3.0-or-later

NPM Tool That Audits Projects For Broken Links

Package Exports

  • link-inspector
  • link-inspector/dist/index.js

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 (link-inspector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version Total Downloads

link-inspector

Automatically scan links, files, and directories for broken links.

API

linkInspector(arg, callback)

The arg can be a link, file path, or directory path. The callback will be given the broken link and path of the link.

Examples

import linkInspector from 'link-inspector';

linkInspector('http://example.com', function (link) {
   console.log(`Broken link found: ${link}`);
});

If you want to use linkInspector on all the files in a directory:

import linkInspector from 'link-inspector';

linkInspector('./path/to/directory', function (link, path, lineNumber) {
   console.log(`Broken link ${link} found in ${path} on line ${lineNumber}`);
});

Command Line Interface

There is also a cli. You can install it with:

npm install link-inspector -g

You can use it on a links, file paths, or directory paths.

npx link-inspector ./path/to/directory

The cli tool will write the link in an output folder.

output/
│
├── subfolder/
│   ├── file1.txt
│   └── file2.txt
│
├── file3.txt
└── file4.txt

Development

  1. Clone

    git clone https://github.com/justindhillon/link-inspector.git
    cd link-inspector
  2. Install Dependencies

    npm install
  3. Build the npm package

    npm run build
  4. Run the npm package

    npx link-inspector <file/directory path>
  5. Testing the npm package

    npm run test

License

link-inspector uses the AGPL-3.0 license.