# url-checker

> Checks URLs for safety, using several methods

Latest version **0.1.0** (published 2018-08-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install url-checker
pnpm add url-checker
yarn add url-checker
bun add url-checker
```

## 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.1.0 |
| Published | 2018-08-15 |
| First published | 2018-08-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Sng Swee Keat |
| Maintainers | sngsweekeat |

## Links

- npm: https://www.npmjs.com/package/url-checker
- Repository: https://github.com/sngsweekeat/url-checker
- Homepage: https://github.com/sngsweekeat/url-checker#readme
- Issues: https://github.com/sngsweekeat/url-checker/issues
- npm.io page: https://npm.io/package/url-checker

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.88.0
- [safe-browse-url-lookup](https://npm.io/package/safe-browse-url-lookup.md) 0.0.4

## Recent versions

- 0.1.0 (latest) — 2018-08-15

## README

# url-checker

Simple checks on URLs, for 'safety' or 'maliciousness'. Types of checking:

1. Google Safe Browsing - uses Google Safe Browsing Lookup API
2. Content-type whitelisting - uses HTTP HEAD to check Content-Type header of destination resource against a whitelist of accepted content-types

## Usage
``` javascript
const UrlChecker = require('url-checker');
...
const uc = new UrlChecker({
    // options
});
uc.check('http://some-url-t0-check.org/blah/')
    .then(results => {
        // do stuff with results
    });
```
The `check()` method returns a promise that resolves to an array. The array can contain strings indicating issues resulting from the checks made; if there are no issues found, the array is empty.

## Options
The options passed in to the `UrlChecker` constructor:

|Key                                |Description    |
|---                                |---            |
|`useGoogleSafeBrowsing`            |`boolean` indicating whether to use Google Safe Browsing. *Default: `true`*|
|`googleSafeBrowsingAPIKey`         |API key to use. **Compulsory** if `useSafeBrowsing` is `true`.|
|`useContentType`                   |`boolean` indicating whether to use content-type whitelisting. *Default: `true`*|
|**TODO:** `contentTypeWhitelist`   |An array of strings indicating content-types to whitelist, e.g. `['text/html', 'text/plain']`. *Default: `['text/html']`*

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