{"id":21905395,"url":"https://github.com/hex7c0/transfer-rate","last_synced_at":"2025-10-13T20:31:39.510Z","repository":{"id":19659983,"uuid":"22913041","full_name":"hex7c0/transfer-rate","owner":"hex7c0","description":"calculate transfer-rate of request/response for Nodejs","archived":false,"fork":false,"pushed_at":"2024-03-25T22:51:50.000Z","size":2543,"stargazers_count":6,"open_issues_count":7,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-13T19:19:46.533Z","etag":null,"topics":["bandwidth","nodejs","rate"],"latest_commit_sha":null,"homepage":"https://github.com/hex7c0/transfer-rate","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"etsy/statsd","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hex7c0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2014-08-13T11:18:24.000Z","updated_at":"2024-04-23T00:48:13.195Z","dependencies_parsed_at":"2024-04-23T00:48:10.631Z","dependency_job_id":"c3493163-fcbc-424b-951b-fe43b9be85e2","html_url":"https://github.com/hex7c0/transfer-rate","commit_stats":{"total_commits":90,"total_committers":2,"mean_commits":45.0,"dds":"0.022222222222222254","last_synced_commit":"7c12564883126fd711813e45c30687c2c5179419"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Ftransfer-rate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Ftransfer-rate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Ftransfer-rate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Ftransfer-rate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex7c0","download_url":"https://codeload.github.com/hex7c0/transfer-rate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173060,"owners_count":21224481,"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":["bandwidth","nodejs","rate"],"created_at":"2024-11-28T16:33:12.106Z","updated_at":"2025-10-13T20:31:39.430Z","avatar_url":"https://github.com/hex7c0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [transfer-rate](https://github.com/hex7c0/transfer-rate)\n\n[![NPM version](https://img.shields.io/npm/v/transfer-rate.svg)](https://www.npmjs.com/package/transfer-rate)\n[![Linux Status](https://img.shields.io/travis/hex7c0/transfer-rate.svg?label=linux-osx)](https://travis-ci.org/hex7c0/transfer-rate)\n[![Windows Status](https://img.shields.io/appveyor/ci/hex7c0/transfer-rate.svg?label=windows)](https://ci.appveyor.com/project/hex7c0/transfer-rate)\n[![Dependency Status](https://img.shields.io/david/hex7c0/transfer-rate.svg)](https://david-dm.org/hex7c0/transfer-rate)\n[![Coveralls](https://img.shields.io/coveralls/hex7c0/transfer-rate.svg)](https://coveralls.io/r/hex7c0/transfer-rate)\n\nCalculate transfer-rate of request/response with different option for customization.\nBuild a function that, calculate ratio between data and time.\n\n## Installation\n\nInstall through NPM\n\n```bash\nnpm install transfer-rate\n```\nor\n```bash\ngit clone git://github.com/hex7c0/transfer-rate.git\n```\n\n## API\n\ninside expressjs project\n```js\nvar transfer = require('transfer-rate');\nvar app = require('express')();\n\nvar rate = transfer();\n\napp.get('/', function(req, res) {\n\n  var start = process.hrtime();\n  res.send('ok');\n  console.log(transfer(req, res, start));\n});\n```\n\n### Methods\n\nCalculation is store inside `res` and `req` **Object** and returned from function.\n```js\nreq.transferRate\n```\n\n### transfer(options) // builder\n\n#### options\n\n - `data` **String** Accepted string are related to http://en.wikipedia.org/wiki/Data_rate_units `[Byte, KB, MB, bit, Kb, Mb]` *(default \"KB\")*\n - `time` - **String** Accepted string for calculate ratio are `[nanosecond, millisecond, second]` *(default \"second\")*\n - `response` - **Boolean** Flag for calculate transfer rate of response(true) or request(false) *(default \"response\")*\n - `output` - **Boolean** Flag for display(true) extra information like `KB/s` or only data(false) as string *(default \"display\")*\n\n### rate(req, res, start) // calculator\n\n#### req\n\n - `req` - **Object** Client request object *(default \"required\")*\n\n#### res\n\n - `res` - **Object** Client response object *(default \"required\")*\n\n#### start\n\n - `start` - **Array** High precision time, from `process.hrtime()` *(default \"required\")*\n\n## Examples\n\nTake a look at my [examples](examples)\n\nFor chunked data, wait for a fix with event emitter https://github.com/hex7c0/transfer-rate/tree/master/examples/chunk_res.js or use [on-finished](https://github.com/jshttp/on-finished) module\n\n### [License Apache2](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Ftransfer-rate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex7c0%2Ftransfer-rate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Ftransfer-rate/lists"}