{"name":"@szmarczak/http-timer","version":"1.1.2","description":"Timings for HTTP requests","main":"source","engines":{"node":">=6"},"scripts":{"test":"xo && nyc ava","coveralls":"nyc report --reporter=text-lcov | coveralls"},"keywords":["http","https","timer","timings"],"repository":{"type":"git","url":"git+https://github.com/szmarczak/http-timer.git"},"author":{"name":"Szymon Marczak"},"license":"MIT","bugs":{"url":"https://github.com/szmarczak/http-timer/issues"},"homepage":"https://github.com/szmarczak/http-timer#readme","xo":{"rules":{"unicorn/filename-case":"camelCase"}},"devDependencies":{"ava":"^0.25.0","coveralls":"^3.0.2","p-event":"^2.1.0","nyc":"^12.0.2","xo":"^0.22.0"},"dependencies":{"defer-to-connect":"^1.0.1"},"gitHead":"010f7732043933ec6309045f01473af3495591c4","_id":"@szmarczak/http-timer@1.1.2","_npmVersion":"6.5.0-next.0","_nodeVersion":"11.6.0","_npmUser":{"name":"szmarczak","email":"sz.marczak@gmail.com"},"dist":{"integrity":"sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==","shasum":"b1665e2c461a2cd92f4c1bbf50d5454de0d4b421","tarball":"http://registry-npm.ywwl.com/@szmarczak/http-timer/download/@szmarczak/http-timer-1.1.2.tgz","fileCount":4,"unpackedSize":6296,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcL4whCRA9TVsSAnZWagAA5pgP/3DWndgx0zab0GQZ0r6z\nxahulxeCKn6PCn+v4S214bPpTO7rRnOiotJT46gx7aKx0G8rx5Vnaf3Isx/s\nJ3rdoO3qLw8ISl9CnRlqRHnr1xd7k+IKir5tAHIJTA0eFEZpaizaH56j/xDS\nLcTsmXRlGkDp8Xp7fRTN1dXseCdtDcOM7+4f3+18oviB3vW65Z1UFa1SrvJ4\nJOmgsn/Q8d9yIlmL6TpXpiHoymOx35Aqu/vMFnXMnRJQ1zHJd9XmS1EBfBl5\n4VWrB//a/c9IrYmt7z+xIms173qmVEA3TwRVjkaMfs/9baafKMdyI4ztUtsW\nnwf6aoYBMbf/06VPiU3L5rKIht9WesfBrk01vZDr3M9+Yjy294PAvvTSTJEw\nj4Yyp55HJ6NzLYO6MbS4k0+TNK4vexYI3ocRosaEZyqpye6gAr0Xo6mvmWDD\nI7q4oyaIicAiidgLkgrd46URKddKwvx9PoycyRxZS9MxjUte6X0XK2ODjYqI\n8BSgwMIhk87fSPTL7UeFQpD9vFm15YVhV+gyiPVFy43LtuevAVJsnZQ9EV2S\nV5M7TwSmiI1Ue0FH3sQIeeQtDu2pM0ewCQmNTHDfq/Fj63FAxWEFqPZgWxTF\nOtnFgQNTZX9YXQMpvgsvJWm8a59vo17ene7vXqeXNPHHLWcJaF5VhkugBk6L\n8Uy/\r\n=WwTF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEvIG1rl0K2QJ36+bXlciUEvX/cUYgfP2hBw7mP9PK6EAiBaaIVviS1T/5GsUiEmHCWgImTZ4rgsAuvB8tdNFxSumg=="}],"size":2636,"noattachment":false,"key":"/@szmarczak/http-timer/-/@szmarczak/http-timer-1.1.2.tgz"},"maintainers":[{"name":"szmarczak","email":"sz.marczak@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-timer_1.1.2_1546619937020_0.7812035537643258"},"_hasShrinkwrap":false,"readme":"# http-timer\n> Timings for HTTP requests\n\n[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)\n[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)\n[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)\n\nInspired by the [`request` package](https://github.com/request/request).\n\n## Installation\n\nNPM:\n\n> `npm install @szmarczak/http-timer`\n\nYarn:\n\n> `yarn add @szmarczak/http-timer`\n\n## Usage\n**Note:**\n> - The measured events resemble Node.js events, not the kernel ones.\n> - Sending a chunk greater than [`highWaterMark`](https://nodejs.org/api/stream.html#stream_new_stream_writable_options) will result in invalid `upload` and `response` timings. You can avoid this by splitting the payload into smaller chunks.\n\n```js\nimport https from 'https';\nimport timer from '@szmarczak/http-timer';\n\nconst request = https.get('https://httpbin.org/anything');\ntimer(request);\n\nrequest.once('response', response => {\n\tresponse.resume();\n\tresponse.once('end', () => {\n\t\tconsole.log(response.timings); // You can use `request.timings` as well\n\t});\n});\n\n// {\n//   start: 1572712180361,\n//   socket: 1572712180362,\n//   lookup: 1572712180415,\n//   connect: 1572712180571,\n//   upload: 1572712180884,\n//   response: 1572712181037,\n//   end: 1572712181039,\n//   error: undefined,\n//   abort: undefined,\n//   phases: {\n//     wait: 1,\n//     dns: 53,\n//     tcp: 156,\n//     request: 313,\n//     firstByte: 153,\n//     download: 2,\n//     total: 678\n//   }\n// }\n```\n\n## API\n\n### timer(request)\n\nReturns: `Object`\n\n**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.\n\n- `start` - Time when the request started.\n- `socket` - Time when a socket was assigned to the request.\n- `lookup` - Time when the DNS lookup finished.\n- `connect` - Time when the socket successfully connected.\n- `secureConnect` - Time when the socket securely connected.\n- `upload` - Time when the request finished uploading.\n- `response` - Time when the request fired `response` event.\n- `end` - Time when the response fired `end` event.\n- `error` - Time when the request fired `error` event.\n- `abort` - Time when the request fired `abort` event.\n- `phases`\n\t- `wait` - `timings.socket - timings.start`\n\t- `dns` - `timings.lookup - timings.socket`\n\t- `tcp` - `timings.connect - timings.lookup`\n\t- `tls` - `timings.secureConnect - timings.connect`\n\t- `request` - `timings.upload - (timings.secureConnect || timings.connect)`\n\t- `firstByte` - `timings.response - timings.upload`\n\t- `download` - `timings.end - timings.response`\n\t- `total` - `(timings.end || timings.error || timings.abort) - timings.start`\n\nIf something has not been measured yet, it will be `undefined`.\n\n## License\n\nMIT\n","publish_time":1546619937153,"_cnpm_publish_time":1546619937153,"dist-tags":{"latest":"5.0.1"}}