Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 1.57 KB

README.md

File metadata and controls

64 lines (43 loc) · 1.57 KB

limits

Simple express/connect middleware to set limit to upload size, set request timeout etc.

It is responsible for:

  • Preventing upload completely. In config, use: { file_uploads: false }

  • Limiting the total size of upload In config, use: { post_max_size: [bytes] }

  • Setting a global absolute timeout for both incoming and outgoing connections In config, use: { global_timeout: [millis] }, if 0 - no timeout is set

  • Setting a global absolute timeout for incoming connections only In config, use: { inc_req_timeout: [millis] }, if 0 - no timeout is set

  • Setting a global absolute timeout for outgoing connections only In config, use: { out_req_timeout: [millis] }, if 0 - no timeout is set

  • Setting idle timeout for incoming connections In config, use: { idle_timeout: [millis] }, if 0 - no timeout is set

  • Setting the http.Agent.defaultMaxSockets for the entire app In config, use: { max_sockets: [number] }, if 0 - nothing will be set.

To completely disable module use config, { enable: false }

install

With npm do:

npm install limits

usage

var express = require('express'),
    limits = require('limits');

var app = express();

var limits_config = {
    enable: true,
    file_uploads: true,
    post_max_size: 2000000
}

app.use(limits(limits_config));

app.listen(8000);

Build Status

Build Status

Node Badge

NPM