{"id":17382,"library":"throttled-request","title":"Throttle HTTP Requests with `request`","description":"throttled-request is a Node.js module designed to apply rate-limiting to outgoing HTTP requests by wrapping the now-deprecated `request` library. It provides functionality to configure request throttling based on a fixed rate (e.g., N requests within M milliseconds) or a dynamic delay determined by a provided function. The package is currently at version 0.1.1, indicating an early development stage and a lack of active maintenance. Its release cadence is effectively inactive, as its last update was long ago, and its core dependency, `request`, has been officially deprecated and archived. This module's primary differentiator was its simple integration with the `request` API, making it easy for users of that library to add throttling. However, its strong reliance on an unmaintained dependency makes it unsuitable for modern applications, which should seek alternatives built on actively maintained HTTP clients.","status":"abandoned","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/alltherooms/throttled-request","tags":["javascript","request","throttle","throttled","throttling"],"install":[{"cmd":"npm install throttled-request","lang":"bash","label":"npm"},{"cmd":"yarn add throttled-request","lang":"bash","label":"yarn"},{"cmd":"pnpm add throttled-request","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP request functionality that `throttled-request` wraps and enhances. This is a hard dependency for the package's core functionality.","package":"request","optional":false}],"imports":[{"note":"The package exports a factory function that must be called with an instance of the `request` library to create the throttled requester. Uses CommonJS `require` syntax and is not designed for ESM.","wrong":"import throttledRequest from 'throttled-request';","symbol":"throttledRequest","correct":"var request = require('request');\nvar throttledRequest = require('throttled-request')(request);"},{"note":"The `configure` method takes a single object as its argument to define throttling parameters, either a fixed rate or a function for dynamic delays.","wrong":"throttledRequest.configure(5, 1000);","symbol":"throttledRequest.configure","correct":"throttledRequest.configure({\n  requests: 5,\n  milliseconds: 1000\n});"},{"note":"The `throttledRequest` instance is an EventEmitter, allowing listeners for events like 'request' which fires after each actual HTTP call is made.","wrong":"throttledRequest.addListener('request', function () {});","symbol":"throttledRequest.on('request')","correct":"throttledRequest.on('request', function () {\n  console.log('Making a request');\n});"}],"quickstart":{"code":"var request = require('request')\n,   throttledRequest = require('throttled-request')(request)\n,   startedAt = Date.now();\n\nthrottledRequest.configure({\n  requests: 2,\n  milliseconds: 1000\n});\n\nthrottledRequest.on('request', function () {\n  console.log('Making a request. Elapsed time: %d ms', Date.now() - startedAt);\n});\n\n//Throttle 10 requests in parallel to 'https://www.google.com/'\n// Replace 'https://www.google.com/' with a safe, public URL for testing.\n// In a real application, handle errors and ensure proper resource cleanup.\nfor (var i = 0; i < 10; i++) {\n  throttledRequest('https://www.google.com/', function (error, response, body) {\n    if (error) {\n      console.error('Request failed:', error.message);\n      return;\n    }\n    console.log('Got response for request %d. Status: %d. Elapsed time: %d ms', i, response.statusCode, Date.now() - startedAt);\n  });\n}","lang":"javascript","description":"This example demonstrates how to set up `throttled-request`, configure a rate limit of 2 requests per second, listen for the 'request' event, and then make 10 throttled HTTP GET requests to a public URL."},"warnings":[{"fix":"Migrate away from `throttled-request` and its `request` dependency. Choose a modern, actively maintained HTTP client like `node-fetch`, `axios`, or the built-in `http`/`https` modules, and then integrate a separate, maintained throttling library or implement throttling directly.","message":"The underlying `request` library, which `throttled-request` wraps, has been officially deprecated and is no longer maintained. This poses significant security risks (unpatched vulnerabilities) and stability concerns for any application using this package, as it will not receive updates or bug fixes.","severity":"breaking","affected_versions":">=0.1.1"},{"fix":"Always use the main `throttledRequest(options, callback)` or `throttledRequest(options).pipe(...)` syntax for all HTTP requests. Specify the HTTP method within the `options` object (e.g., `{ method: 'POST', url: '...' }`).","message":"This package does not expose the convenient HTTP verb shortcut methods (e.g., `.get()`, `.post()`, `.put()`) that the original `request` library provided. All requests must be made via the primary `throttledRequest(options, callback)` function or as a stream.","severity":"gotcha","affected_versions":">=0.1.1"},{"fix":"Given the package's age and low version, it is strongly recommended to use actively maintained alternatives for request throttling in modern Node.js environments to ensure stability, security, and compatibility.","message":"The package version 0.1.1 indicates an early, potentially unstable, and unmaintained state. It has not seen updates in a long time, suggesting potential compatibility issues with newer Node.js versions, unaddressed bugs, or missing modern features.","severity":"gotcha","affected_versions":">=0.1.1"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure you `require('request')` separately and then pass that instance to `throttled-request` to initialize it: `var request = require('request'); var throttledRequest = require('throttled-request')(request);`","cause":"The `throttled-request` package exports a factory function that needs to be called with an instance of the `request` library, but it was used directly or called without the `request` dependency.","error":"TypeError: throttledRequest is not a function"},{"fix":"Use the main `throttledRequest(options, callback)` signature for all HTTP requests, specifying the method in the `options` object (e.g., `throttledRequest({ method: 'GET', url: '...' }, callback);`).","cause":"Attempting to use a shortcut method like `.get()` or `.post()` which `throttled-request` does not implement; it only provides the main function signature.","error":"TypeError: throttledRequest.get is not a function"},{"fix":"While this error highlights the underlying problem, the ultimate solution for `throttled-request` is to migrate away from this package entirely due to its dependency on deprecated software. Consider modern HTTP clients and throttling solutions.","cause":"This warning indicates that `throttled-request` depends on the `request` library, which is officially deprecated and unmaintained.","error":"npm WARN deprecated request@x.y.z: request has been deprecated"}],"ecosystem":"npm","meta_description":null}