Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@types/wait-on
Advanced tools
@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
Additional Details
These definitions were written by Ifiok Jr. https://github.com/ifiokjr.
FAQs
TypeScript definitions for wait-on
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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.