{"id":18672973,"url":"https://github.com/vicanso/http-performance","last_synced_at":"2025-11-06T23:30:22.816Z","repository":{"id":57148535,"uuid":"99119159","full_name":"vicanso/http-performance","owner":"vicanso","description":"Get the http perfomance","archived":false,"fork":false,"pushed_at":"2017-08-31T00:15:19.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T04:33:35.454Z","etag":null,"topics":["http","http-perf","http-performance","performance"],"latest_commit_sha":null,"homepage":null,"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/vicanso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-02T13:25:33.000Z","updated_at":"2022-06-09T09:07:52.000Z","dependencies_parsed_at":"2022-08-31T20:02:17.100Z","dependency_job_id":null,"html_url":"https://github.com/vicanso/http-performance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicanso%2Fhttp-performance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicanso%2Fhttp-performance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicanso%2Fhttp-performance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicanso%2Fhttp-performance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vicanso","download_url":"https://codeload.github.com/vicanso/http-performance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239513379,"owners_count":19651322,"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":["http","http-perf","http-performance","performance"],"created_at":"2024-11-07T09:13:35.202Z","updated_at":"2025-11-06T23:30:22.747Z","avatar_url":"https://github.com/vicanso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-performance\n\nI use `httpstat` to test my rest api's performance and then I want to write a module to get the performance of `http`.\n\nThe moudle can get the request and response of `http`, including `dns`, `method`, `url` and so on.\n\n[![Build Status](https://travis-ci.org/vicanso/http-performance.svg?branch=master)](https://travis-ci.org/vicanso/http-performance)\n[![Coverage Status](https://img.shields.io/coveralls/vicanso/http-performance/master.svg?style=flat)](https://coveralls.io/r/vicanso/http-performance?branch=master)\n[![npm](http://img.shields.io/npm/v/http-performance.svg?style=flat-square)](https://www.npmjs.org/package/http-performance)\n[![Github Releases](https://img.shields.io/npm/dm/http-performance.svg?style=flat-square)](https://github.com/vicanso/http-performance)\n\n## API\n\n```js\n// please require the module first\nconst httpPerf = require('http-performance');\nconst http = require('http');\nhttpPerf.on('stats', (stats) =\u003e {\n/*  { category: 'request',\n  dns: { ip: '14.215.177.38', addressType: 4 },\n  requesting: 0,\n  method: 'GET',\n  host: 'www.baidu.com',\n  url: '/',\n  status: 200,\n  bytes: 15358,\n  timing: { socket: 9, dns: 2, tcp: 6, processing: 13, transfer: 5, all: 35 } }\n*/\n  console.info(stats);\n});\nhttp.get('http://www.baidu.com/');\n```\n\n\n```js\n// please require the module first\nconst httpPerf = require('http-performance');\nconst http = require('http');\nconst express = require('express');\nhttpPerf.on('stats', (stats) =\u003e {\n  if (stats.type !== 'response') {\n    return;\n  }\n/* { category: 'response',\n  method: 'GET',\n  timing: { all: 1013, socket: 0 },\n  status: 200,\n  url: '/',\n  bytes: 60,\n  responsing: 0 }\n*/\n  console.info(stats);\n});\nconst app = express();\napp.use((req, res, next) =\u003e setTimeout(next, 1000));\napp.use((req, res) =\u003e {\n  res.json({\n    message: 'hello world',\n  });\n});\n\nconst server = app.listen();\nconst url = `http://127.0.0.1:${server.address().port}`;\nhttp.get(url);\n```\n\n### disable/enable\n\n- type The http type, 'request' or 'response'\n\nDiable or enable the http stats type, default is enabled.\n\n```js\nconst httpPerf = require('http-performance');\nhttpPerf.disable('request');\nhttpPerf.enable('request');\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicanso%2Fhttp-performance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvicanso%2Fhttp-performance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicanso%2Fhttp-performance/lists"}