New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

connect-throttle

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-throttle

Connect throttling middleware

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

Build Status

Connect Throttle

Installation

npm install connect-throttle

Request throttling using sleep

var connect = require('connect');
var throttle = require('connect-throttle');
connect()
  .use(throttle.sleep(1000))
  .use(function(req, res) {
    console.log('1 req/s');
    res.end('');
  }).listen(3000);

Try:

ab localhost:3000/

Pass a function instead of a fixed value:

var connect = require('connect');
var throttle = require('connect-throttle');
connect()
  .use(connect.responseTime())
  .use(throttle.sleep(function() { return Math.floor(Math.random() * 500); }))
  .use(function(req, res) {
    res.end('');
  }).listen(3000);

FAQs

Package last updated on 25 Jun 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts