Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@types/wait-on
Advanced tools
TypeScript definitions for wait-on
@types/wait-on is a TypeScript type definition package for the wait-on library, which is used to wait for various resources to become available before proceeding. This can include HTTP(s) endpoints, TCP ports, file paths, and more.
Wait for HTTP(s) endpoints
This feature allows you to wait for HTTP or HTTPS endpoints to become available. The code sample demonstrates how to wait for a local server and an external website to be accessible.
const waitOn = require('wait-on');
const opts = {
resources: [
'http://localhost:3000',
'https://example.com'
]
};
waitOn(opts, function (err) {
if (err) { return handleError(err); }
// HTTP(s) endpoints are now available
});
Wait for TCP ports
This feature allows you to wait for a specific TCP port to be available. The code sample demonstrates how to wait for a TCP port on localhost.
const waitOn = require('wait-on');
const opts = {
resources: [
'tcp:localhost:8080'
]
};
waitOn(opts, function (err) {
if (err) { return handleError(err); }
// TCP port is now available
});
Wait for file paths
This feature allows you to wait for a specific file path to become available. The code sample demonstrates how to wait for a file to be created or become accessible.
const waitOn = require('wait-on');
const opts = {
resources: [
'file:/path/to/file.txt'
]
};
waitOn(opts, function (err) {
if (err) { return handleError(err); }
// File path is now available
});
Wait for multiple resources
This feature allows you to wait for multiple types of resources simultaneously. The code sample demonstrates how to wait for an HTTP endpoint, a TCP port, and a file path all at once.
const waitOn = require('wait-on');
const opts = {
resources: [
'http://localhost:3000',
'tcp:localhost:8080',
'file:/path/to/file.txt'
]
};
waitOn(opts, function (err) {
if (err) { return handleError(err); }
// All resources are now available
});
wait-for-it is a pure bash script that will wait on the availability of a host and TCP port. It is useful for shell scripting and is more lightweight compared to wait-on, but it does not support waiting for HTTP endpoints or file paths.
wait-for-localhost is a Node.js package that waits for localhost to be ready. It is simpler and more focused compared to wait-on, as it only supports waiting for localhost and does not handle other types of resources like file paths or external HTTP endpoints.
tcp-ping is a Node.js package that pings a TCP port to check its availability. It is more specialized compared to wait-on, focusing solely on TCP ports and not supporting other resource types like HTTP endpoints or file paths.
npm install --save @types/wait-on
This package contains type definitions for wait-on (https://github.com/jeffbski/wait-on#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wait-on.
These definitions were written by Ifiok Jr., and Andrew Leedham.
FAQs
TypeScript definitions for wait-on
The npm package @types/wait-on receives a total of 864,884 weekly downloads. As such, @types/wait-on popularity was classified as popular.
We found that @types/wait-on demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.