Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timed-out

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timed-out

Timeout HTTP/HTTPS requests

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3M
decreased by-11.46%
Maintainers
2
Weekly downloads
 
Created

What is timed-out?

The 'timed-out' npm package is used to timeout HTTP requests. It provides a simple way to set timeouts for various stages of an HTTP request, such as the connection, socket, and response stages.

What are timed-out's main functionalities?

Set timeout for HTTP request

This feature allows you to set a timeout for an HTTP request. In this example, a timeout of 5 seconds is set for the HTTP GET request to 'http://example.com'. If the request takes longer than 5 seconds, it will be aborted.

const http = require('http');
const timedOut = require('timed-out');

const req = http.get('http://example.com', (res) => {
  // Handle response
});

// Set a timeout of 5 seconds
const timeout = 5000;
timedOut(req, timeout);

Set timeout for specific stages

This feature allows you to set timeouts for specific stages of an HTTP request. In this example, different timeouts are set for the connection, socket, and response stages of the HTTP GET request to 'http://example.com'.

const http = require('http');
const timedOut = require('timed-out');

const req = http.get('http://example.com', (res) => {
  // Handle response
});

// Set timeouts for different stages
const options = {
  connect: 1000, // 1 second for connection
  socket: 2000,  // 2 seconds for socket
  response: 3000 // 3 seconds for response
};
timedOut(req, options);

Other packages similar to timed-out

Keywords

FAQs

Package last updated on 22 Apr 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc