Giter VIP home page Giter VIP logo

node-limits's Introduction

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] }, if 0, this functionality is disabled

  • Limiting the length of uri In config, use: { uri_max_length: [number] }, if 0 this functionality is disabled

  • 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.

  • Setting the socket noDelay In config, use: { socket_no_delay: [boolean] }, if false - nothing will be set.

To completely disable module use config, { enable: false }. Each of the above functionality is disabled if corresponding config attribute is not set.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.