{"id":15984749,"url":"https://github.com/jaredreisinger/throttled-request","last_synced_at":"2025-04-04T20:46:21.359Z","repository":{"id":146779067,"uuid":"42125704","full_name":"JaredReisinger/throttled-request","owner":"JaredReisinger","description":"A rate-limited wrapper around request.","archived":false,"fork":false,"pushed_at":"2015-09-09T07:22:48.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T05:26:12.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaredReisinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-08T16:45:45.000Z","updated_at":"2015-09-08T17:14:25.000Z","dependencies_parsed_at":"2023-04-07T08:06:34.142Z","dependency_job_id":null,"html_url":"https://github.com/JaredReisinger/throttled-request","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/JaredReisinger%2Fthrottled-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredReisinger%2Fthrottled-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredReisinger%2Fthrottled-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaredReisinger%2Fthrottled-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaredReisinger","download_url":"https://codeload.github.com/JaredReisinger/throttled-request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249602,"owners_count":20908211,"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":[],"created_at":"2024-10-08T02:10:20.573Z","updated_at":"2025-04-04T20:46:21.328Z","avatar_url":"https://github.com/JaredReisinger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# throttled-request\n\nA rate-limited wrapper around request.\n\n[![npm version](https://img.shields.io/npm/v/throttled-request\n.svg)](https://travis-ci.org/JaredReisinger/throttled-request)\n[![build status](https://img.shields.io/travis/JaredReisinger/throttled-request/master.svg)](https://travis-ci.org/JaredReisinger/throttled-request)\n[![code coverage](https://img.shields.io/codecov/c/github/JaredReisinger/throttled-request.svg)](https://travis-ci.org/JaredReisinger/throttled-request)\n[![dependencies](https://img.shields.io/david/JaredReisinger/throttled-request.svg)](https://travis-ci.org/JaredReisinger/throttled-request)\n\n\n----\n\nInterrupts [request](https://www.npmjs.com/package/request)s normal flow of operations by limiting the rate at which new requests can be made.  Unlike other generic-function-throttling modules, this does not drop calls on the floor... all requests will _eventually_ be made.\n\nThis was written to assist in limiting web-crawling behavior; it's assumed that slowing down the requests will also slow down the discovery of new URLs.  It was _not_ designed to simply be given hundreds of URLs an ensure that the process doesn't exit until everything's been fetched; you're responsible for your own process management in that case.\n\n\n### Usage\n\nRather than pulling [request](https://www.npmjs.com/package/request) in as a direct dependecy, you'll need to \"inject\" it into throttled-request as a parameter.  Further, because this monkey-patches the regular export from the `request` module, you _still_ won't get throttling.  You also have to either pass in a `throttleWindow` options property for each request or (more commonly) use `request.defaults()` to create a requestor that always provides a sensible default value:\n\n```javascript\nvar throttledRequest = require('throttled-request')(require('request'));\nvar request = throttledRequest.defaults({ throttleWindow: 10000 });\n```\n\nOnce you've done that, you can use the new request function just as you always did:\n\n```javascript\nvar throttledRequest = require('throttled-request')(require('request'));\nvar request = throttledRequest.defaults({ throttleWindow: 10000 });\n\n// treat `request` just as you always did... it's just throttled now!\nvar req1 = request('http://example.com');\nvar req2 = request('http://example.com');   // happens 10 seconds later\nvar req3 = request('http://example.com');   // ... and 10 seconds after that!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredreisinger%2Fthrottled-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredreisinger%2Fthrottled-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredreisinger%2Fthrottled-request/lists"}