# node-linkchecker

> Find broken links and broken fragments

Latest version **0.0.3** (published 2016-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-linkchecker
pnpm add node-linkchecker
yarn add node-linkchecker
bun add node-linkchecker
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2016-03-14 |
| First published | 2016-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.1.2 |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Denis Ah-Kang |
| Maintainers | tripu, w3c |
| Keywords | w3c, broken-links |

## Links

- npm: https://www.npmjs.com/package/node-linkchecker
- Repository: https://github.com/w3c/node-linkchecker
- Homepage: https://github.com/w3c/node-linkchecker#readme
- Issues: https://github.com/w3c/node-linkchecker/issues
- npm.io page: https://npm.io/package/node-linkchecker

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [whacko](https://npm.io/package/whacko.md) ^0.19.1
- [promise](https://npm.io/package/promise.md) ^7.1.1
- [superagent](https://npm.io/package/superagent.md) ^1.7.2
- [resolve-url](https://npm.io/package/resolve-url.md) ^0.2.1

## Recent versions

- 0.0.3 (latest) — 2016-03-14
- 0.0.2 — 2016-02-19
- 0.0.1 — 2016-02-19

## README

[![Build Status](https://travis-ci.org/w3c/node-linkchecker.svg?branch=master)](https://travis-ci.org/w3c/node-linkchecker)
[![Dependency Status](https://david-dm.org/w3c/insafe.svg)](https://david-dm.org/w3c/insafe)
[![devDependency Status](https://david-dm.org/w3c/insafe/dev-status.svg)](https://david-dm.org/w3c/insafe#info=devDependencies)

# Linkchecker

Detect broken links and broken fragments

## Installation

```
npm install node-linkchecker
```

## Usage

### `.check(url[, options])`

Find broken links and optionally broken fragments on a given url.
Parameters:
* `url`: the url you want to check
* `options`: provide that parameter if you want to override the default options. See [below](#options) for more details

Example:

```js
var nlc = require('./lib/node-linkchecker');
nlc.check("http://www.example.org/").then(function(result) {
  if(result.brokenLinks.length > 0) {
    console.log('the document contains broken links');
  }
  if(result.brokenFragments.length > 0) {
    console.log('the document contains broken fragments');
  }
});

###
var nlc = require('./lib/node-linkchecker')
,   options = {
      schemes: ["https:"],
      userAgent: "W3C node linkchecker",
      fragments: false
    };

nlc.check("https://www.example.org/", options)
   .then(function(result) {
     // { brokenLinks: [], brokenFragments: [] }
   }, function(err) {
     console.log('rejection');
   });
```

### Options

| 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`                |

### TODO list

* add support for robot exclusions
* handle base `href`
* improve result feedback and format
* add tests

---
_Source: https://npm.io/package/node-linkchecker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
