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

wait-on

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wait-on

wait-on is a cross platform command line utility and Node.js API which will wait for files, ports, sockets, and http(s) resources to become available

  • 8.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is wait-on?

The wait-on npm package is a cross-platform command line utility and Node.js API that will wait for files, ports, sockets, and http(s) resources to become available. It is commonly used in automated scripts, such as before starting tests or ensuring that services are up before proceeding with the next steps in a script.

What are wait-on's main functionalities?

Waiting for files to exist

This feature allows you to wait for one or more files to exist before executing the next part of your script.

const waitOn = require('wait-on');

const opts = {
  resources: [
    'file1',
    'path/to/file2'
  ]
};

waitOn(opts, function (err) {
  if (err) return handleError(err);
  // Files are now available
});

Waiting for HTTP resources

This feature allows you to wait for HTTP(s) resources to respond with a successful status code before continuing.

const waitOn = require('wait-on');

const opts = {
  resources: [
    'http://foo.com:8000/bar'
  ],
  delay: 1000, // initial delay in ms, default 0
  interval: 100, // poll interval in ms, default 250ms
  timeout: 30000, // timeout in ms, default Infinity
  window: 1000 // stabilization time in ms, default 750ms
};

waitOn(opts, function (err) {
  if (err) return handleError(err);
  // HTTP resource is now available
});

Waiting for TCP ports

This feature allows you to wait for a TCP port to be open, indicating that a service is listening on the specified port.

const waitOn = require('wait-on');

const opts = {
  resources: [
    'tcp:localhost:8000'
  ]
};

waitOn(opts, function (err) {
  if (err) return handleError(err);
  // TCP port is now available
});

Waiting for socket files

This feature allows you to wait for a Unix socket file to be available.

const waitOn = require('wait-on');

const opts = {
  resources: [
    'socket:/path/to/socket'
  ]
};

waitOn(opts, function (err) {
  if (err) return handleError(err);
  // Socket file is now available
});

Other packages similar to wait-on

Keywords

FAQs

Package last updated on 10 Sep 2024

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