{"name":"link-check","version":"4.4.2","description":"checks whether a hyperlink is alive (200 OK) or dead","main":"index.js","scripts":{"pretest":"jshint index.js","test":"mocha -R spec --exit"},"repository":{"type":"git","url":"git://github.com/tcort/link-check.git"},"keywords":["link","check","checker","hyperlink","alive","dead","HTTP","head"],"author":{"name":"Thomas Cort","email":"linuxgeek@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/tcort/link-check/issues"},"homepage":"https://github.com/tcort/link-check#readme","dependencies":{"is-relative-url":"^2.0.0","isemail":"^3.1.2","ms":"^2.1.1","request":"^2.86.0"},"devDependencies":{"expect.js":"^0.3.1","express":"^4.16.3","jshint":"^2.9.5","mocha":"^5.1.1"},"jshintConfig":{"bitwise":true,"curly":true,"eqeqeq":true,"forin":true,"freeze":true,"globalstrict":true,"immed":true,"indent":4,"moz":true,"newcap":true,"noarg":true,"node":true,"noempty":true,"nonew":true,"trailing":true,"undef":true,"smarttabs":true,"strict":true,"validthis":true,"globals":{"describe":false,"it":false,"before":false,"beforeEach":false,"after":false,"afterEach":false}},"gitHead":"7899ed72e3ed24100c03f59fa980c1b382564e11","_id":"link-check@4.4.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"tcort","email":"linuxgeek@gmail.com"},"dist":{"integrity":"sha512-5zIQtLWLLV5x/Pf0p3LRUx2YNyW0tUeRSSHycRd5yRZejtFSWsU7PpHfe/cvpu3ctWPah78IbixLe5tnsblO1A==","shasum":"1576226ec1d590343ad44177ac6cff6c582a893c","tarball":"http://registry-npm.ywwl.com/link-check/download/link-check-4.4.2.tgz","fileCount":15,"unpackedSize":21152,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEoo5CRA9TVsSAnZWagAAii8QAIG3TYkDR+dVFJqkFxvA\nESlbwnziKmsmvwTNGci+W9XvTQuiZVxQ22R30mPoMaU08Tl6D2BJSA5R1tJK\nODQvpD97V95e9jRiLqD63jq/sS6vFq+nx0nLAxcFXgokte3k6kzfPL3BIDEX\nyA00JDg+vsTHnlTxpWnv2od8urXRvEXbtnP9BSHVlZmJOG9zP6tjV3JM2Ig+\nrc5UF5Bf1T0C6Qo19qD8UM0U0I79dFCDz9J6YyXWrCOo+e+2qse4dKi79NhZ\n6uOJCA1gKcoldgv/ACxGDis6+HNGQsPrR+xatPrq5jA12QEaVRg5q33ee4nr\n88FeW8SCr7s97hgtRbwr2LhrS2gviw4o0/xVhsAcsWok1ZuoLSPDHvwCYuH4\nuiHvV4Xg8xEMOhtEVtmGwtl9XAl3D/WdaFCwAbSK7+PGmWkrTI4LZUMe7obw\nrDCDp0hvL9pOKMXcusSXQaHhWQeZp9gIk18mMVNnILFVKGbD3HmnKPjOZMoi\nVjK/gO5SZMP72n0JkBI6PNFGIBWQErRmh2325DUS4knY5g7/QkEZRUpcHkGi\nfNyLg1LPs3+dHmejN2ynt97/9VzjaOhVy9Hj5v32ExAJpZ40xyoJQaZ928Lf\n8ogG7oQNgfvSuOYf3OrNZKvh1pQN9ifBLfs/WnD9qgQYVdm40uVhEK18aySS\nazTa\r\n=vJ3Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsa3xTcwYkhUGT701nooG1pKZM0b9TdB9YVgCuorva8QIhAOA7i36I0g1QvgVJdXhRlYR666IYFGYlxZEaDz2OQKQ4"}],"size":5619,"noattachment":false,"key":"/link-check/-/link-check-4.4.2.tgz"},"maintainers":[{"name":"tcort","email":"linuxgeek@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/link-check_4.4.2_1527941688504_0.17635998150845955"},"_hasShrinkwrap":false,"readme":"![Test library workflow status](https://github.com/tcort/link-check/workflows/Test%20library/badge.svg)\n\n# link-check\n\nChecks whether a hyperlink is alive (`200 OK`) or dead.\n\n## Installation\n\n```console\nnpm install --save link-check\n```\n\n## Specification\n\nA link is said to be 'alive' if an HTTP HEAD or HTTP GET for the given URL\neventually ends in a `200 OK` response. To minimize bandwidth, an HTTP HEAD\nis performed. If that fails (e.g. with a `405 Method Not Allowed`), an HTTP\nGET is performed. Redirects are followed.\n\nIn the case of `mailto:` links, this module validates the e-mail address\nusing [isemail](https://www.npmjs.com/package/isemail).\n\n## API\n\n### linkCheck(link, [opts,] callback)\n\nGiven a `link` and a `callback`, attempt an HTTP HEAD and possibly an HTTP GET.\n\nParameters:\n\n* `url` string containing a URL.\n* `opts` optional options object containing any of the following optional fields:\n  * `anchors` array of anchor strings (e.g. `[ \"#foo\", \"#bar\" ]`) for checking anchor links (e.g. `<a href=\"#foo\">Foo</a>`).\n  * `baseUrl` the base URL for relative links.\n  * `timeout` timeout in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `\"2000ms\"`, `20s`, `1m`). Default `10s`.\n  * `user_agent` the user-agent string. Default `${name}/${version}` (e.g. `link-check/4.5.5`)\n  * `aliveStatusCodes` an array of numeric HTTP Response codes which indicate that the link is alive. Entries in this array may also be regular expressions. Example: `[ 200, /^[45][0-9]{2}$/ ]`.  Default `[ 200 ]`.\n  * `headers` a string based attribute value object to send custom HTTP headers. Example: `{ 'Authorization' : 'Basic Zm9vOmJhcg==' }`.\n  * `retryOn429` a boolean indicating whether to retry on a 429 (Too Many Requests) response. When true, if the response has a 429 HTTP code and includes an optional `retry-after` header, a retry will be attempted after the delay indicated in the `retry-after` header. If no `retry-after` header is present in the response or the `retry-after` header value is not valid according to [RFC7231](https://tools.ietf.org/html/rfc7231#section-7.1.3) (value must be in seconds), a default retry delay of 60 seconds will apply. This default can be overriden by the `fallbackRetryDelay` parameter.\n  * `retryCount` the number of retries to be made on a 429 response. Default `2`.\n  * `fallbackRetryDelay` the delay in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `\"2000ms\"`, `20s`, `1m`) for retries on a 429 response when no `retry-after` header is returned or when it has an invalid value. Default is `60s`.\n* `callback` function which accepts `(err, result)`.\n  * `err` an Error object when the operation cannot be completed, otherwise `null`.\n  * `result` an object with the following properties:\n    * `link` the `link` provided as input\n    * `status` a string set to either `alive` or `dead`.\n    * `statusCode` the HTTP status code. Set to `0` if no HTTP status code was returned (e.g. when the server is down).\n    * `err` any connection error that occurred, otherwise `null`.\n\n## Examples\n\n```js\n'use strict';\n\nconst linkCheck = require('link-check');\n\nlinkCheck('http://example.com', function (err, result) {\n    if (err) {\n        console.error(err);\n        return;\n    }\n    console.log(`${result.link} is ${result.status}`);\n});\n```\n\n**With basic authentication:**\n\n```js\n'use strict';\n\nconst linkCheck = require('link-check');\n\nlinkCheck('http://example.com', { headers: { 'Authorization': 'Basic Zm9vOmJhcg==' } }, function (err, result) {\n    if (err) {\n        console.error(err);\n        return;\n    }\n    console.log(`${result.link} is ${result.status}`);\n});\n```\n\n## Testing\n\n```console\nnpm test\n```\n\n## License\n\nSee [LICENSE.md](https://github.com/tcort/link-check/blob/master/LICENSE.md)\n","publish_time":1527941688742,"_cnpm_publish_time":1527941688742,"dist-tags":{"latest":"5.6.0"}}