Check Broken Links
An npm package that checks an array of supplied links for broken links.
const check = const containsBroken = 'https://www.iCONTAINbrokenlinks.com' 'https://www.iAMbroken.com' 'https://www.iamfine.com'
The base url for the relative links has a required trailing slash.
Mocha testing example
Let's say you want to check if your project has any broken links:
// Get polyfill so we can use full ES6 in the tests // Get the expect functionality // Display results as table // Import the link checkerconst check = // We do not use arrow syntax here because that would break the this.timeout
Configuration
Want the module to console.log every request set the environment variable 'verbose' to true:
verbose=true node app.js
This will log out every request. Successfull requests turn green, failed ones red.
The GET requests have a default timeout of 60 seconds. You can set this using the 'gettimeout' environment variable in seconds.
# 2 minute timeout gettimeout=120 node app.js