• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..20-Sep-2020-

licenseH A D26-Oct-19851.1 KiB2217

package.jsonH A D20-Sep-20201.5 KiB6867

readme.mdH A D26-Oct-1985986 4325

readme.md

1# timed-out [![Build Status](https://travis-ci.org/floatdrop/timed-out.svg?branch=master)](https://travis-ci.org/floatdrop/timed-out)
2
3> Timeout HTTP/HTTPS requests
4
5Emit Error object with `code` property equal `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged.
6
7## Usage
8
9```js
10var get = require('http').get;
11var timeout = require('timed-out');
12
13var req = get('http://www.google.ru');
14timeout(req, 2000); // Set 2 seconds limit
15```
16
17### API
18
19#### timedout(request, time)
20
21##### request
22
23*Required*
24Type: [`ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest)
25
26The request to watch on.
27
28##### time
29
30*Required*
31Type: `number` or `object`
32
33Time in milliseconds to wait for `connect` event on socket and also time to wait on inactive socket.
34
35Or you can pass Object with following fields:
36
37- `connect` - time to wait for connection
38- `socket`  - time to wait for activity on socket
39
40## License
41
42MIT © [Vsevolod Strukchinsky](floatdrop@gmail.com)
43