{"id":28539343,"url":"https://github.com/yourtion/node-elimiter","last_synced_at":"2025-08-08T08:40:01.617Z","repository":{"id":57222401,"uuid":"142408334","full_name":"yourtion/node-elimiter","owner":"yourtion","description":"easy use rate limiter","archived":false,"fork":false,"pushed_at":"2019-08-22T05:29:33.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-08T10:45:54.461Z","etag":null,"topics":["distributed-limiting","node-elimiter","rate-limits","redis-limiter"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yourtion.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":"2018-07-26T07:56:55.000Z","updated_at":"2019-08-22T05:29:35.000Z","dependencies_parsed_at":"2022-09-08T21:50:59.233Z","dependency_job_id":null,"html_url":"https://github.com/yourtion/node-elimiter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yourtion/node-elimiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-elimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-elimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-elimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-elimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yourtion","download_url":"https://codeload.github.com/yourtion/node-elimiter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourtion%2Fnode-elimiter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269391962,"owners_count":24409724,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["distributed-limiting","node-elimiter","rate-limits","redis-limiter"],"created_at":"2025-06-09T18:31:38.287Z","updated_at":"2025-08-08T08:40:01.587Z","avatar_url":"https://github.com/yourtion.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![David deps][david-image]][david-url]\n[![node version][node-image]][node-url]\n[![npm download][download-image]][download-url]\n[![npm license][license-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/elimiter.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/elimiter\n[travis-image]: https://img.shields.io/travis/yourtion/node-elimiter.svg?style=flat-square\n[travis-url]: https://travis-ci.org/yourtion/node-elimiter\n[coveralls-image]: https://img.shields.io/coveralls/yourtion/node-elimiter.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/yourtion/node-elimiter?branch=master\n[david-image]: https://img.shields.io/david/yourtion/node-elimiter.svg?style=flat-square\n[david-url]: https://david-dm.org/yourtion/node-elimiter\n[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg?style=flat-square\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/elimiter.svg?style=flat-square\n[download-url]: https://npmjs.org/package/elimiter\n[license-image]: https://img.shields.io/npm/l/elimiter.svg\n\n# node-elimiter\n\nEasy rate limiter.\n\n## Install\n\n```bash\n$ npm install elimiter --save\n```\n\n## How to use\n\n```typescript\nimport Limiter from \"elimiter\";\n\nconst db = new Redis();\n\n// limit 5 call in 60s (60*1000ms)\nconst limiter = new Limiter(db, { id: \"ip\", max: 5, duration: 60 * 1000 });\n\nconst res = await limit.get(); // limit.get(req.ip), limit(userid)\nif (res.remaining \u003c 1) throw new Errror(\"out of limit\");\n// continue\n```\n\n```typescript\n// Get with reset and resetMs\nconst res = await limit.get({ reset: true });\nconsole.log(res);\n// { count: 0, remaining: 5, total: 5, reset: 1546438588, resetMs: 1546438588062 }\nif (res.remaining \u003c 1) throw new Errror(\"out of limit\");\n// continue\n```\n\n## Benchmark\n\nPlatform info:\n\n- Linux 4.4.0-101-generic x64\n- Node.JS: 10.15.0\n- V8: 6.8.275.32-node.45\n  Intel(R) Xeon(R) CPU @ 2.30GHz × 2\n\n3 tests success:\n\n| test | rps |  ns/op | spent |\n| --- | --- | --- | --- |\n| `limit.get({ reset: true })` | 10172.0 | 98309.4 | 2.012s |\n| `limit.get()` | 11529.1 | 86736.9 | 2.009s |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fnode-elimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyourtion%2Fnode-elimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourtion%2Fnode-elimiter/lists"}