# timed-out

> Timeout HTTP/HTTPS requests

Latest version **7.0.0** (published 2025-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install timed-out
pnpm add timed-out
yarn add timed-out
bun add timed-out
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2025-09-09 |
| First published | 2014-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 49 |
| Maintainers | sindresorhus |
| Keywords | http, https, timeout, get, url, uri, request, simple |

## Links

- npm: https://www.npmjs.com/package/timed-out
- Repository: https://github.com/sindresorhus/timed-out
- Homepage: https://github.com/sindresorhus/timed-out#readme
- Issues: https://github.com/sindresorhus/timed-out/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/timed-out

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 7.0.0 (latest) — 2025-09-09
- 6.0.0 — 2021-04-22
- 5.0.0 — 2019-09-08
- 4.0.1 — 2017-01-16
- 4.0.0 — 2016-12-29
- 3.1.3 — 2016-12-29
- 3.1.2 — 2016-12-28
- 3.1.1 — 2016-12-27
- 3.1.0 — 2016-12-14
- 3.0.0 — 2016-09-18
- 2.0.0 — 2014-12-02
- 1.0.0 — 2014-11-21

## README

# timed-out

> Timeout HTTP/HTTPS requests

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

## Usage

```js
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`](https://nodejs.org/api/http.html#http_class_http_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.

---
_Source: https://npm.io/package/timed-out · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
