npm.io
1.0.1 • Published 8 years ago

timelimit

Licence
ISC
Version
1.0.1
Deps
0
Size
6 kB
Vulns
0
Weekly
0

timelimit

NPM version Downloads Dependency status Dev Dependency status

Reject promises on timeout.

Installation

npm install --save timelimit

Usage

Basic usage:

import timelimit from 'timelimit'

const req = timelimit(
  fetch('https://example.com'),
  10000, // 10 seconds
  {
    rejectOnTimeout: true, // default is true
    errorMessage: 'timeout', // timeout error message (thrown if rejectOnTimeout is true)
  },
)

Keywords