
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
wait-for-localhost
Advanced tools
Wait for localhost to be ready
Useful if you need a local server to be ready to accept requests before doing other things.
Supports both HTTP/1 and HTTP/2 servers with automatic fallback.
npm install wait-for-localhost
import waitForLocalhost from 'wait-for-localhost';
await waitForLocalhost({port: 8080});
console.log('Server is ready');
Returns a Promise<object> that settles when localhost is ready.
The object contains an ipVersion property with a value of either 6 or 4 depending on the IP version that was used.
Type: object
Type: number
Default: 80
Type: string
Default: '/'
Use a custom path.
For example, /health for a health-check endpoint.
Type: boolean
Default: false
Use the GET HTTP-method instead of HEAD to check if the server is running.
Type: number[]
Default: [200]
HTTP status codes to consider as successful responses.
Type: AbortSignal
An AbortSignal to abort the operation.
import waitForLocalhost from 'wait-for-localhost';
// Timeout after 5 seconds
await waitForLocalhost({
port: 8080,
signal: AbortSignal.timeout(5000)
});
FAQs
Wait for localhost to be ready
The npm package wait-for-localhost receives a total of 5,450 weekly downloads. As such, wait-for-localhost popularity was classified as popular.
We found that wait-for-localhost demonstrated a healthy version release cadence and project activity because the last version was released less than 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 discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.