pnpm
Version:
Fast, disk space efficient package manager
186 lines (185 loc) • 13.1 kB
JSON
{
"_args": [
[
{
"raw": "agentkeepalive@4.0.0",
"scope": null,
"escapedName": "agentkeepalive",
"name": "agentkeepalive",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/@pnpm/npm-registry-agent"
]
],
"_from": "agentkeepalive@4.0.0",
"_hasShrinkwrap": false,
"_id": "agentkeepalive@4.0.0",
"_location": "/agentkeepalive",
"_nodeVersion": "8.11.4",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/agentkeepalive_4.0.0_1540226500501_0.7738264829072481"
},
"_npmUser": {
"name": "fengmk2",
"email": "fengmk2@gmail.com"
},
"_npmVersion": "6.4.1",
"_phantomChildren": {
"ms": "2.1.1"
},
"_requested": {
"raw": "agentkeepalive@4.0.0",
"scope": null,
"escapedName": "agentkeepalive",
"name": "agentkeepalive",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"_requiredBy": [
"/@pnpm/npm-registry-agent"
],
"_resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.0.0.tgz",
"_shasum": "777e7e4c828bde2690cc7a374ede587d45ba4271",
"_shrinkwrap": null,
"_spec": "agentkeepalive@4.0.0",
"_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/@pnpm/npm-registry-agent",
"author": {
"name": "fengmk2",
"email": "fengmk2@gmail.com",
"url": "https://fengmk2.com"
},
"browser": "browser.js",
"bugs": {
"url": "https://github.com/node-modules/agentkeepalive/issues"
},
"ci": {
"version": "8, 10"
},
"contributors": [
{
"name": "fengmk2",
"email": "fengmk2@gmail.com",
"url": "https://github.com/fengmk2"
},
{
"name": "Will White",
"email": "will@mapbox.com",
"url": "https://github.com/willwhite"
},
{
"name": "dead-horse",
"email": "heyiyu.deadhorse@gmail.com",
"url": "https://github.com/dead-horse"
},
{
"name": "Zsolt Lattmann",
"email": "lattmann@isis.vanderbilt.edu",
"url": "https://github.com/lattmann"
},
{
"name": "Patrick Malouin",
"email": "p.malouin@gmail.com",
"url": "https://github.com/pmalouin"
},
{
"name": "Alexander Penev",
"email": "alexander.penev@sap.com",
"url": "https://github.com/saperal"
},
{
"name": "Dylan Piercey",
"email": "pierceydylan@gmail.com",
"url": "https://github.com/DylanPiercey"
},
{
"name": "Marcio Rodrigues",
"email": "marcio.silva@vivareal.com",
"url": "https://github.com/marciorodrigues87"
}
],
"dependencies": {
"debug": "^4.1.0",
"depd": "^1.1.2",
"humanize-ms": "^1.2.1"
},
"description": "Missing keepalive http.Agent",
"devDependencies": {
"autod": "^3.0.1",
"egg-bin": "^4.9.0",
"egg-ci": "^1.10.0",
"eslint": "^5.7.0",
"eslint-config-egg": "^7.1.0",
"mm": "^2.4.1",
"pedding": "^1.1.0"
},
"directories": {},
"dist": {
"integrity": "sha512-McCjHBAI3FGTy9XOMDr/8qzXK4VBL3h+O/TqlBdsyiwX21SdPCQhPIX0Y1HS5ctO5m2maVQRJWEn0IrzKRB6oQ==",
"shasum": "777e7e4c828bde2690cc7a374ede587d45ba4271",
"tarball": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.0.0.tgz",
"fileCount": 10,
"unpackedSize": 32071,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbzf3FCRA9TVsSAnZWagAA0iYP+wb9voqXSTuwdM88RdVd\nMlpn4LxnmrO72yJ2sbBMLq67h/qMuv0fOIv/klOol63k0doMItOvKLfD2fHN\n/0ZI8tknANi46jawTXrTTMoXW62WYQg51z8d1xSrLxtqWMmQlHMIIww2gxej\nXk19yXwShHhaSaoYyktikVhLjoSZr2+ziqLFZOqIPPUsX9M/i9AjugWD0vbO\nn57JZ24N2PtIn/eICSaPauqkCc1JQGaKnIInFitfWuCY9g/SwpSfldUnUx4g\nizx1TFfHXIuxBT9HluV03gronCf+Mc/v4J77b6raSWzdmSGZCUIQA6Y3fZtK\npaYMEleXHzqSp9CANyNJhok+rwtGoqBjJjlhLhsTTiHFaa9ziANpRPyfwBBG\nGhujNryTi+TroUq+z7Qfpb88NqCACJ1fAuY3INpyGjr2f4Uq4003y8fgfSgT\nKpOZ96k3rGnYQ6PtMao5oy4xwwkpGuSYupvpqaGdwUmI/ej1ILLdTNMgj/UE\nRM1cJ6/du7eTMgglZAcFAAmjFlTmsOvJrH+9V/BL1DVPSxhmyUZn4qxVEEEY\neR60/Ca/W496CeNg8PPn3+7TC5ZZL6LlS5TJppx+VsnUSBUMM7vcnBvZiaUd\ndCYyjR+ME2lR5mBfD4q+vxfOTn4nU+VmAIar+FALzcfYuNlRWtR+AS9IC2qH\nTdvc\r\n=zaxf\r\n-----END PGP SIGNATURE-----\r\n"
},
"engines": {
"node": ">= 8.0.0"
},
"files": [
"index.js",
"index.d.ts",
"browser.js",
"lib"
],
"gitHead": "0de1968973acce3a373af5ed381b8c8da7b25e2b",
"homepage": "https://github.com/node-modules/agentkeepalive#readme",
"keywords": [
"http",
"https",
"agent",
"keepalive",
"agentkeepalive",
"HttpAgent",
"HttpsAgent"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "dead_horse",
"email": "dead_horse@qq.com"
},
{
"name": "dead-horse",
"email": "dead_horse@qq.com"
},
{
"name": "fengmk2",
"email": "fengmk2@gmail.com"
},
{
"name": "popomore",
"email": "sakura9515@gmail.com"
}
],
"name": "agentkeepalive",
"optionalDependencies": {},
"readme": "# agentkeepalive\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Appveyor status][appveyor-image]][appveyor-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/agentkeepalive.svg?style=flat\n[npm-url]: https://npmjs.org/package/agentkeepalive\n[travis-image]: https://img.shields.io/travis/node-modules/agentkeepalive.svg?style=flat\n[travis-url]: https://travis-ci.org/node-modules/agentkeepalive\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/k7ct4s47di6m5uy2?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/fengmk2/agentkeepalive\n[codecov-image]: https://codecov.io/gh/node-modules/agentkeepalive/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/agentkeepalive\n[david-image]: https://img.shields.io/david/node-modules/agentkeepalive.svg?style=flat\n[david-url]: https://david-dm.org/node-modules/agentkeepalive\n[snyk-image]: https://snyk.io/test/npm/agentkeepalive/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/agentkeepalive\n[download-image]: https://img.shields.io/npm/dm/agentkeepalive.svg?style=flat-square\n[download-url]: https://npmjs.org/package/agentkeepalive\n\nThe enhancement features `keep alive` `http.Agent`. Support `http` and `https`.\n\n## What's different from original `http.Agent`?\n\n- `keepAlive=true` by default\n- Disable Nagle's algorithm: `socket.setNoDelay(true)`\n- Add free socket timeout: avoid long time inactivity socket leak in the free-sockets queue.\n- Add active socket timeout: avoid long time inactivity socket leak in the active-sockets queue.\n- TTL for active socket.\n\n## Node.js version required\n\nSupport Node.js >= `8.0.0`\n\n## Install\n\n```bash\n$ npm install agentkeepalive --save\n```\n\n## new Agent([options])\n\n* `options` {Object} Set of configurable options to set on the agent.\n Can have the following fields:\n * `keepAlive` {Boolean} Keep sockets around in a pool to be used by\n other requests in the future. Default = `true`.\n * `keepAliveMsecs` {Number} When using the keepAlive option, specifies the initial delay\n for TCP Keep-Alive packets. Ignored when the keepAlive option is false or undefined. Defaults to 1000.\n Default = `1000`. Only relevant if `keepAlive` is set to `true`.\n * `freeSocketTimeout`: {Number} Sets the free socket to timeout\n after `freeSocketTimeout` milliseconds of inactivity on the free socket.\n Default is `15000`.\n Only relevant if `keepAlive` is set to `true`.\n * `timeout`: {Number} Sets the working socket to timeout\n after `timeout` milliseconds of inactivity on the working socket.\n Default is `freeSocketTimeout * 2`.\n * `maxSockets` {Number} Maximum number of sockets to allow per\n host. Default = `Infinity`.\n * `maxFreeSockets` {Number} Maximum number of sockets (per host) to leave open\n in a free state. Only relevant if `keepAlive` is set to `true`.\n Default = `256`.\n * `socketActiveTTL` {Number} Sets the socket active time to live, even if it's in use.\n If not setted the behaviour continues the same (the socket will be released only when free)\n Default = `null`.\n\n## Usage\n\n```js\nconst http = require('http');\nconst Agent = require('agentkeepalive');\n\nconst keepaliveAgent = new Agent({\n maxSockets: 100,\n maxFreeSockets: 10,\n timeout: 60000, // active socket keepalive for 60 seconds\n freeSocketTimeout: 30000, // free socket keepalive for 30 seconds\n});\n\nconst options = {\n host: 'cnodejs.org',\n port: 80,\n path: '/',\n method: 'GET',\n agent: keepaliveAgent,\n};\n\nconst req = http.request(options, res => {\n console.log('STATUS: ' + res.statusCode);\n console.log('HEADERS: ' + JSON.stringify(res.headers));\n res.setEncoding('utf8');\n res.on('data', function (chunk) {\n console.log('BODY: ' + chunk);\n });\n});\nreq.on('error', e => {\n console.log('problem with request: ' + e.message);\n});\nreq.end();\n\nsetTimeout(() => {\n if (keepaliveAgent.statusChanged) {\n console.log('[%s] agent status changed: %j', Date(), keepaliveAgent.getCurrentStatus());\n }\n}, 2000);\n\n```\n\n### `getter agent.statusChanged`\n\ncounters have change or not after last checkpoint.\n\n### `agent.getCurrentStatus()`\n\n`agent.getCurrentStatus()` will return a object to show the status of this agent:\n\n```js\n{\n createSocketCount: 10,\n closeSocketCount: 5,\n timeoutSocketCount: 0,\n requestCount: 5,\n freeSockets: { 'localhost:57479:': 3 },\n sockets: { 'localhost:57479:': 5 },\n requests: {}\n}\n```\n\n### Support `https`\n\n```js\nconst https = require('https');\nconst HttpsAgent = require('agentkeepalive').HttpsAgent;\n\nconst keepaliveAgent = new HttpsAgent();\n// https://www.google.com/search?q=nodejs&sugexp=chrome,mod=12&sourceid=chrome&ie=UTF-8\nconst options = {\n host: 'www.google.com',\n port: 443,\n path: '/search?q=nodejs&sugexp=chrome,mod=12&sourceid=chrome&ie=UTF-8',\n method: 'GET',\n agent: keepaliveAgent,\n};\n\nconst req = https.request(options, res => {\n console.log('STATUS: ' + res.statusCode);\n console.log('HEADERS: ' + JSON.stringify(res.headers));\n res.setEncoding('utf8');\n res.on('data', chunk => {\n console.log('BODY: ' + chunk);\n });\n});\n\nreq.on('error', e => {\n console.log('problem with request: ' + e.message);\n});\nreq.end();\n\nsetTimeout(() => {\n console.log('agent status: %j', keepaliveAgent.getCurrentStatus());\n}, 2000);\n```\n\n## [Benchmark](https://github.com/node-modules/agentkeepalive/tree/master/benchmark)\n\nrun the benchmark:\n\n```bash\ncd benchmark\nsh start.sh\n```\n\nIntel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz\n\nnode@v0.8.9\n\n50 maxSockets, 60 concurrent, 1000 requests per concurrent, 5ms delay\n\nKeep alive agent (30 seconds):\n\n```js\nTransactions: 60000 hits\nAvailability: 100.00 %\nElapsed time: 29.70 secs\nData transferred: 14.88 MB\nResponse time: 0.03 secs\nTransaction rate: 2020.20 trans/sec\nThroughput: 0.50 MB/sec\nConcurrency: 59.84\nSuccessful transactions: 60000\nFailed transactions: 0\nLongest transaction: 0.15\nShortest transaction: 0.01\n```\n\nNormal agent:\n\n```js\nTransactions: 60000 hits\nAvailability: 100.00 %\nElapsed time: 46.53 secs\nData transferred: 14.88 MB\nResponse time: 0.05 secs\nTransaction rate: 1289.49 trans/sec\nThroughput: 0.32 MB/sec\nConcurrency: 59.81\nSuccessful transactions: 60000\nFailed transactions: 0\nLongest transaction: 0.45\nShortest transaction: 0.00\n```\n\nSocket created:\n\n```bash\n[proxy.js:120000] keepalive, 50 created, 60000 requestFinished, 1200 req/socket, 0 requests, 0 sockets, 0 unusedSockets, 50 timeout\n{\" <10ms\":662,\" <15ms\":17825,\" <20ms\":20552,\" <30ms\":17646,\" <40ms\":2315,\" <50ms\":567,\" <100ms\":377,\" <150ms\":56,\" <200ms\":0,\" >=200ms+\":0}\n----------------------------------------------------------------\n[proxy.js:120000] normal , 53866 created, 84260 requestFinished, 1.56 req/socket, 0 requests, 0 sockets\n{\" <10ms\":75,\" <15ms\":1112,\" <20ms\":10947,\" <30ms\":32130,\" <40ms\":8228,\" <50ms\":3002,\" <100ms\":4274,\" <150ms\":181,\" <200ms\":18,\" >=200ms+\":33}\n```\n\n## License\n\n[MIT](LICENSE)\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/node-modules/agentkeepalive.git"
},
"scripts": {
"autod": "autod",
"ci": "npm run lint && npm run cov",
"cov": "egg-bin cov",
"lint": "eslint lib test index.js",
"test": "npm run lint && egg-bin test",
"test-local": "egg-bin test"
},
"version": "4.0.0"
}