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

wait-port

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wait-port

Utility to wait for a TCP port to open.

  • 0.2.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
decreased by-7.11%
Maintainers
1
Weekly downloads
 
Created

What is wait-port?

The wait-port npm package is a utility that allows you to wait for a port on a host to become open. This is particularly useful in scenarios where you need to ensure that a service is up and running before proceeding with the next steps in your application or script. It can be used programmatically within your Node.js applications or as a command-line tool.

What are wait-port's main functionalities?

Waiting for a port programmatically

This feature allows you to wait for a specific port on a host to become open by using the wait-port package programmatically within your Node.js application. The `waitPort` function returns a promise that resolves to a boolean indicating whether the port opened before the timeout.

const waitPort = require('wait-port');

const params = {
  host: 'localhost',
  port: 3000
};

waitPort(params).then((open) => {
  if(open) console.log('The port is now open!');
  else console.log('The port did not open before the timeout.');
});

Using wait-port as a CLI tool

wait-port can also be used as a command-line tool. This example demonstrates how to wait for port 3000 on localhost to become open by using wait-port in the terminal. It's useful for scripting and automation tasks outside of Node.js applications.

wait-port --host localhost --port 3000

Other packages similar to wait-port

FAQs

Package last updated on 26 May 2020

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