Socket
Socket
Sign inDemoInstall

timed-out

Package Overview
Dependencies
0
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    timed-out

Timeout HTTP/HTTPS requests


Version published
Weekly downloads
3M
decreased by-19.44%
Maintainers
2
Install size
5.36 kB
Created
Weekly downloads
 

Readme

Source

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.

timed-out for enterprise

Available as part of the Tidelift Subscription.

The maintainers of timed-out and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Keywords

FAQs

Last updated on 22 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc