{"id":13464885,"url":"https://github.com/transitive-bullshit/check-links","last_synced_at":"2025-05-15T02:06:23.945Z","repository":{"id":37733234,"uuid":"144353682","full_name":"transitive-bullshit/check-links","owner":"transitive-bullshit","description":"Robustly checks an array of URLs for liveness. Extremely fast ⚡","archived":false,"fork":false,"pushed_at":"2024-12-17T13:55:55.000Z","size":445,"stargazers_count":340,"open_issues_count":4,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-14T10:56:58.177Z","etag":null,"topics":["links","urls","validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitive-bullshit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["transitive-bullshit"]}},"created_at":"2018-08-11T03:55:56.000Z","updated_at":"2025-02-25T21:20:51.000Z","dependencies_parsed_at":"2024-01-13T21:44:19.901Z","dependency_job_id":"b8b2264c-06c4-415c-9155-6c6cfbcf535c","html_url":"https://github.com/transitive-bullshit/check-links","commit_stats":{"total_commits":46,"total_committers":4,"mean_commits":11.5,"dds":"0.10869565217391308","last_synced_commit":"651042d465e21cb2cdb226be1b1bf26de8e42bde"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fcheck-links","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fcheck-links/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fcheck-links/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fcheck-links/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitive-bullshit","download_url":"https://codeload.github.com/transitive-bullshit/check-links/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259370,"owners_count":22040819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["links","urls","validation"],"created_at":"2024-07-31T14:00:52.247Z","updated_at":"2025-05-15T02:06:23.928Z","avatar_url":"https://github.com/transitive-bullshit.png","language":"JavaScript","funding_links":["https://github.com/sponsors/transitive-bullshit"],"categories":["JavaScript","目录"],"sub_categories":[],"readme":"# check-links\n\n\u003e Robustly checks an array of URLs for liveness.\n\n[![NPM](https://img.shields.io/npm/v/check-links.svg)](https://www.npmjs.com/package/check-links) [![Build Status](https://github.com/transitive-bullshit/check-links/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/check-links/actions/workflows/test.yml) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)\n\nFor each URL, it first attempts an HTTP HEAD request, and if that fails it will attempt\nan HTTP GET request, retrying several times by default with exponential falloff.\n\nThis module handles concurrency and retry logic so you can check the status of thousands\nof links quickly and robustly.\n\n## Install\n\nThis module requires `node \u003e= 18`.\n\n```bash\nnpm install --save check-links\n# or\nyarn add check-links\n# or\npnpm add check-links\n```\n\nNote: this package uses ESM and no longer provides a CommonJS export. See [here](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) for more info on how to use ESM modules.\n\n## Usage\n\n```js\nimport checkLinks from 'check-links'\n\nconst results = await checkLinks(['https://foo.com', 'https://404.com'])\n\nresults['https://foo.com'] // { status: 'alive', statusCode: 200 }\nresults['https://404.com'] // { status: 'dead', statusCode: 404 }\n\n// example using a custom concurrency, timeout, and retry count\nconst results2 = await checkLinks(['https://foo.com', 'https://404.com'], {\n  concurrency: 1,\n  timeout: { request: 30000 },\n  retry: { limit: 1 }\n})\n```\n\n- Supports HTTP and HTTPS urls.\n- Defaults to a 30 second timeout per HTTP request with 2 retries.\n- Defaults to a Mac OS Chrome `user-agent`.\n- Defaults to following redirects.\n- All options use a [got options object](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md).\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### [checkLinks](https://github.com/transitive-bullshit/check-links/blob/cf5fbcf0fc0bd150097034887b7c132384794549/index.js#L34-L51)\n\nRobustly checks an array of URLs for liveness.\n\nFor each URL, it first attempts an HTTP HEAD request, and if that fails it will attempt\nan HTTP GET request, retrying several times by default with exponential falloff.\n\nReturns a `Map\u003cString, LivenessResult\u003e` that maps each input URL to an object\ncontaining `status` and possibly `statusCode`.\n\n`LivenessResult.status` will be one of the following:\n\n- `alive` if the URL is reachable (2XX status code)\n- `dead` if the URL is not reachable\n- `invalid` if the URL was parsed as invalid or used an unsupported protocol\n\n`LivenessResult.statusCode` will contain an integer HTTP status code if that URL resolved\nproperly.\n\nType: `function (urls, opts)`\n\n- `urls` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e** Array of urls to test\n- `opts` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional configuration options (any extra options are passed to [got](https://github.com/sindresorhus/got#options))\n  - `opts.concurrency` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Maximum number of urls to resolve concurrently (optional, default `8`)\n\n## Related\n\n- [remark-lint-no-dead-urls](https://github.com/davidtheclark/remark-lint-no-dead-urls) - Remark lint plugin that inspired this module.\n\n## License\n\nMIT © [Travis Fischer](https://github.com/transitive-bullshit)\n\nSupport my OSS work by \u003ca href=\"https://twitter.com/transitive_bs\"\u003efollowing me on twitter \u003cimg src=\"https://storage.googleapis.com/saasify-assets/twitter-logo.svg\" alt=\"twitter\" height=\"24px\" align=\"center\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fcheck-links","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitive-bullshit%2Fcheck-links","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fcheck-links/lists"}