{"id":15290149,"url":"https://github.com/npm/agent","last_synced_at":"2025-04-09T19:16:39.339Z","repository":{"id":41336046,"uuid":"509179165","full_name":"npm/agent","owner":"npm","description":"a set of nodejs http Agent classes used by the npm cli","archived":false,"fork":false,"pushed_at":"2025-04-08T20:25:42.000Z","size":156,"stargazers_count":7,"open_issues_count":1,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T19:16:35.083Z","etag":null,"topics":["npm-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-30T17:47:07.000Z","updated_at":"2025-04-08T20:25:45.000Z","dependencies_parsed_at":"2023-12-06T20:39:10.378Z","dependency_job_id":"b57be900-d16b-428f-bc15-093e305484fd","html_url":"https://github.com/npm/agent","commit_stats":{"total_commits":93,"total_committers":7,"mean_commits":"13.285714285714286","dds":0.6236559139784946,"last_synced_commit":"3c71f9adb0cce1ec228c2de0ce420e4c86f7fe46"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npm%2Fagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npm","download_url":"https://codeload.github.com/npm/agent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094988,"owners_count":21046770,"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":["npm-cli"],"created_at":"2024-09-30T16:05:40.560Z","updated_at":"2025-04-09T19:16:39.308Z","avatar_url":"https://github.com/npm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## @npmcli/agent\n\nA pair of Agent implementations for nodejs that provide consistent keep-alives, granular timeouts, dns caching, and proxy support.\n\n### Usage\n\n```js\nconst { getAgent, HttpAgent } = require('@npmcli/agent')\nconst fetch = require('minipass-fetch')\n\nconst main = async () =\u003e {\n    // if you know what agent you need, you can create one directly\n    const agent = new HttpAgent(agentOptions)\n    // or you can use the getAgent helper, it will determine and create an Agent\n    // instance for you as well as reuse that agent for new requests as appropriate\n    const agent = getAgent('https://registry.npmjs.org/npm', agentOptions)\n    // minipass-fetch is just an example, this will work for any http client that\n    // supports node's Agents\n    const res = await fetch('https://registry.npmjs.org/npm', { agent })\n}\n\nmain()\n```\n\n### Options\n\nAll options supported by the node Agent implementations are supported here, see [the docs](https://nodejs.org/api/http.html#new-agentoptions) for those.\n\nOptions that have been added by this module include:\n\n- `family`: what tcp family to use, can be `4` for IPv4, `6` for IPv6 or `0` for both.\n- `proxy`: a URL to a supported proxy, currently supports `HTTP CONNECT` based http/https proxies as well as socks4 and 5.\n- `dns`: configuration for the built-in dns cache\n    - `ttl`: how long (in milliseconds) to keep cached dns entries, defaults to `5 * 60 * 100 (5 minutes)`\n    - `lookup`: optional function to override how dns lookups are performed, defaults to `require('dns').lookup`\n- `timeouts`: a set of granular timeouts, all default to `0`\n    - `connection`: time between initiating connection and actually connecting\n    - `idle`: time between data packets (if a top level `timeout` is provided, it will be copied here)\n    - `response`: time between sending a request and receiving a response\n    - `transfer`: time between starting to receive a request and consuming the response fully\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpm%2Fagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpm%2Fagent/lists"}