Name: node-linkchecker
Owner: World Wide Web Consortium
Description: Detect broken links and broken fragments
Created: 2016-02-17 10:49:26.0
Updated: 2017-12-17 09:14:25.0
Pushed: 2016-03-14 12:12:38.0
Size: 19
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Detect broken links and broken fragments
install node-linkchecker
.check(url[, options])
Find broken links and optionally broken fragments on a given url. Parameters:
url
: the url you want to checkoptions
: provide that parameter if you want to override the default options. See below for more detailsExample:
nlc = require('./lib/node-linkchecker');
check("http://www.example.org/").then(function(result) {
(result.brokenLinks.length > 0) {
console.log('the document contains broken links');
(result.brokenFragments.length > 0) {
console.log('the document contains broken fragments');
nlc = require('./lib/node-linkchecker')
options = {
schemes: ["https:"],
userAgent: "W3C node linkchecker",
fragments: false
};
check("https://www.example.org/", options)
then(function(result) {
// { brokenLinks: [], brokenFragments: [] }
, function(err) {
console.log('rejection');
);
| option | description | default |
| ————- | ——————————————- | ——————— |
| schemes | an array of schemes you want to check | ["http:", "https:"]
|
| userAgent | the user agent to be used for each request | node-linkchecker
|
| fragments | whether to look for broken fragments or not | true
|
href