timeout-request

1.8.0 • Public • Published

timeout-request

NPM version Linux Status Windows Status Dependency Status Coveralls

Set the number of milliseconds that a script is allowed to run in nodejs. If this timeout is reached, res.end() or custom callback will be called

Installation

Install through NPM

npm install timeout-request

or

git clone git://github.com/hex7c0/timeout-request.git

API

inside expressjs project

var timeout = require('timeout-request');
 
var app = require('express')();
 
app.use(timeout());

timeout(options)

options

  • milliseconds - Number Number of milliseconds before callback (default "5000")
  • header - Boolean If enabled, check res._header before callback (default "false")
  • data - Object Object passed to custom callback after req and res (default "null")
  • callback - Function Custom callback instead of res.end (default "null")

Examples

Take a look at my examples

License Apache2

Package Sidebar

Install

npm i timeout-request

Weekly Downloads

2

Version

1.8.0

License

Apache-2.0

Last publish

Collaborators

  • hex7c0