UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

178 lines (177 loc) 14 kB
{ "_args": [ [ { "raw": "agentkeepalive@^3.4.1", "scope": null, "escapedName": "agentkeepalive", "name": "agentkeepalive", "rawSpec": "^3.4.1", "spec": ">=3.4.1 <4.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/make-fetch-happen" ] ], "_from": "agentkeepalive@>=3.4.1 <4.0.0", "_id": "agentkeepalive@3.5.1", "_inCache": true, "_location": "/agentkeepalive", "_nodeVersion": "8.4.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/agentkeepalive_3.5.1_1533008162506_0.5135082950329302" }, "_npmUser": { "name": "fengmk2", "email": "fengmk2@gmail.com" }, "_npmVersion": "5.5.1", "_phantomChildren": {}, "_requested": { "raw": "agentkeepalive@^3.4.1", "scope": null, "escapedName": "agentkeepalive", "name": "agentkeepalive", "rawSpec": "^3.4.1", "spec": ">=3.4.1 <4.0.0", "type": "range" }, "_requiredBy": [ "/make-fetch-happen" ], "_resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.1.tgz", "_shasum": "4eba75cf2ad258fc09efd506cdb8d8c2971d35a4", "_shrinkwrap": null, "_spec": "agentkeepalive@^3.4.1", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/make-fetch-happen", "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": "4, 6, 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": { "humanize-ms": "^1.2.1" }, "description": "Missing keepalive http.Agent", "devDependencies": { "autod": "^3.0.1", "egg-bin": "^1.11.1", "egg-ci": "^1.8.0", "eslint": "^4.19.1", "eslint-config-egg": "^6.0.0", "pedding": "^1.1.0" }, "directories": {}, "dist": { "integrity": "sha512-Cte/sTY9/XcygXjJ0q58v//SnEQ7ViWExKyJpLJlLqomDbQyMLh6Is4KuWJ/wmxzhiwkGRple7Gqv1zf6Syz5w==", "shasum": "4eba75cf2ad258fc09efd506cdb8d8c2971d35a4", "tarball": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.1.tgz", "fileCount": 9, "unpackedSize": 33579, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX9kiCRA9TVsSAnZWagAA5y0P/0WGxUZ4OlOz0AWM8kSu\nd0l4jbPH2ETwz7T2VNcsdjCPkuMM3ffNiQ6LDwG8+1V7ziPOHkUkWbSEsWz7\nlsjwQ0EFBrAI4HbDECt0jz58c15xT6LzsFOmk5VB5KqrJN7MpJeXkFXAHi/t\n8RoQlKvm4RKYD3OimNgoz2XPJg22LAocyL1NGsQsXLhTfy5sFJHtUYY55z43\nx9kjMOE99PifloUHqeAUmIx9MoYajwCygizcWivcc4M/LQDz1Fle2c/a1U0P\npyxPf3fsS+/fbfxPayZ8NjRYvNwK9uWzNfgWWP1C+0jCa27cBUoAvBPuwqSX\nrqsjpRypD1crQ7OZd+9a1jRobTf/FlP9f8yD35vHDAYXyNVy7VzaK3yoBLQc\nNAc6QjQz8ywmwPbOPOeTpPHokAV8jACUqV3pBwud/wLys1dPKnSViSIaS3pl\n1ZH/KzeRxI7CRaFHYnkWo/Ht9sG6586skoQrM3JHh/irjDjhc/Es1SFwk3Bm\neQi9fsF06NELcnnM+emuVe6NxzUH9E5urxfXJHUfut3i0tehmBHKx9AmIz9d\nCeJlSpHBiVQvsVMJXeDgRRhTcUAKBX+xjk/4Cow0W4uByII0MNxVCM+tWwOk\n76OcAhA/TCfPh4x8k2sOsOQA+5KagPk8Z1IfkWy8J/8aOaB+C3KIImXb4cwo\nJ37V\r\n=X7V3\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">= 4.0.0" }, "files": [ "index.js", "index.d.ts", "browser.js", "lib" ], "gitHead": "82ff0e85bfbc282c4bad1ccfabf46d4a82943f6d", "homepage": "https://github.com/node-modules/agentkeepalive#readme", "keywords": [ "http", "https", "agent", "keepalive", "agentkeepalive" ], "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 Node.js's missing `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\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 * `freeSocketKeepAliveTimeout`: {Number} Sets the free socket to timeout\n after `freeSocketKeepAliveTimeout` 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 `freeSocketKeepAliveTimeout * 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,\n freeSocketKeepAliveTimeout: 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```\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```\n(The MIT License)\n\nCopyright(c) node-modules and other contributors.\nCopyright(c) 2012 - 2015 fengmk2 <fengmk2@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\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": "egg-bin test" }, "version": "3.5.1" }