timed-out
Timeout HTTP/HTTPS requests
Last updated a year ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install timed-out 
SYNC missed versions from official npm registry.

timed-out

Timeout HTTP/HTTPS requests

Emits Error object with code property equal ETIMEDOUT or ESOCKETTIMEDOUT when ClientRequest is hanged.

Usage

import http from 'node:http';
import timedOut from 'timed-out';

const request = http.get('http://www.google.ru');
timedOut(request, 2000); // Sets a 2 seconds limit

API

timedout(request, time)

request

Required Type: ClientRequest

The request to watch.

time

Required Type: number | object

Time in milliseconds to wait for a connect event on the socket and also time to wait on inactive socket.

Or you can pass an object with the following fields:

  • connect - Time to wait for a connection.
  • socket - Time to wait for activity on the socket.

Current Tags

  • 7.0.0                                ...           latest (a year ago)

12 Versions

  • 7.0.0                                ...           a year ago
  • 6.0.0                                ...           6 years ago
  • 5.0.0                                ...           7 years ago
  • 4.0.1                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 3.1.3                                ...           10 years ago
  • 3.1.2                                ...           10 years ago
  • 3.1.1                                ...           10 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.0.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 38
Today 0
This Week 1
This Month 17
Last Day 0
Last Week 3
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
  • xo ^1.2.2
Dependents (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE