.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / timed-out / 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
5 Emit Error object with `code` property equal `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged.
6
7 ## Usage
8
9 ```js
10 var get = require('http').get;
11 var timeout = require('timed-out');
12
13 var req = get('http://www.google.ru');
14 timeout(req, 2000); // Set 2 seconds limit
15 ```
16
17 ### API
18
19 #### timedout(request, time)
20
21 ##### request
22
23 *Required*  
24 Type: [`ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest)
25
26 The request to watch on.
27
28 ##### time
29
30 *Required*  
31 Type: `number` or `object`
32
33 Time in milliseconds to wait for `connect` event on socket and also time to wait on inactive socket.
34
35 Or 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
42 MIT © [Vsevolod Strukchinsky](floatdrop@gmail.com)