{"name":"link-check","version":"5.2.0","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":"^4.0.0","isemail":"^3.2.0","ms":"^2.1.3","needle":"^3.1.0"},"devDependencies":{"expect.js":"^0.3.1","express":"^4.18.1","jshint":"^2.13.5","mocha":"^10.0.0","debug":"^4.3.4"},"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":"d7c2fa3e96cb75150ec54da7f9579e207917e1bd","_id":"link-check@5.2.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-xRbhYLaGDw7eRDTibTAcl6fXtmUQ13vkezQiTqshHHdGueQeumgxxmQMIOmJYsh2p8BF08t8thhDQ++EAOOq3w==","shasum":"595a339d305900bed8c1302f4342a29c366bf478","tarball":"http://registry-npm.ywwl.com/link-check/download/link-check-5.2.0.tgz","fileCount":17,"unpackedSize":36743,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6l2FBrSaBJicA+fPi971Slu8ogiG9ocX1MiacVkPwaAIhAOs9lmkGPZWg7WgbIsah6MujsOJj1ehGgawyU/XQXQw/"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKtq5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9YBAAn1zt6PEUA7YKTA4mlMthr5feVB73dSuZ//N8o4djtWh1Kcpx\r\nbz7E9wh6QgzUtq1eeeiPmmcQgYhd6jP6TXmX0mGXwuWLM3ufGHQOTn2ji4UI\r\ntFmyejUgISWMTAd79auL1fPpF6E441IyjHqrXGS3KFiumGz5k8VuNqPxDkrw\r\ncvWLx7oWhdbWGR62eZTjS4tYnpixLjKom+RMPS5xYTTE0gJCyu9RGpB9CFWF\r\nWlb2XOHTgIuwZG9hrXzBmPFaSVjWh/dUZzibvUJg+Gp8ZCf66CUbMpxCJik0\r\nziX/ZcGodVQFeMSmNgoK+LqZLn9G+tn/oxOYH5aSmj7lBZvPXsy8FmhbC+NC\r\ntvtq294OSwtxENu0dRODRhba4f/r1BI/Eqt6t46qWYHXq7zF2Hpi6v8s2eV2\r\nIySSTQJwOt6ch6MPptS/Qgaaue+urAv0iXSUaK89vTNBACFEY3L/hBxqb7gf\r\nyyKhSoJegQn0JTWxAK0ZyfpnOol8nhEwAdK3Qfj7f343ySCi+uKGOFLv02pl\r\nqoBUE1OPRPNWybMi8GG9F96aUIvxfz4XpLHZb572uDA5/c29HJB8D0qjSxNh\r\nIX66QBOU4lRygCZpzFPf+5OcJB2ugUzHH22JkkgRI9dFwbLcg5LxRlv9GoPO\r\n3iF1FQPEELKPIK1kD9iNfFHpMGMtIles6qU=\r\n=vUwL\r\n-----END PGP SIGNATURE-----\r\n","size":9088,"noattachment":false,"key":"/link-check/-/link-check-5.2.0.tgz"},"_npmUser":{"name":"tcort","email":"linuxgeek@gmail.com"},"directories":{},"maintainers":[{"name":"tcort","email":"linuxgeek@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/link-check_5.2.0_1663752889386_0.4923520260288279"},"_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":1663752889567,"_cnpm_publish_time":1663752889567,"dist-tags":{"latest":"5.6.0"}}