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

wait-for-localhost

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wait-for-localhost - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

index.js

17

package.json
{
"name": "wait-for-localhost",
"version": "1.0.0",
"description": "Wait for localhost to be ready from the command-line",
"version": "2.0.0",
"description": "Wait for localhost to be ready",
"license": "MIT",

@@ -12,7 +12,4 @@ "repository": "sindresorhus/wait-for-localhost",

},
"bin": {
"wait-for-localhost": "cli.js"
},
"engines": {
"node": ">=8"
"node": ">=6"
},

@@ -23,7 +20,5 @@ "scripts": {

"files": [
"cli.js"
"index.js"
],
"keywords": [
"cli-app",
"cli",
"wait",

@@ -34,3 +29,4 @@ "localhost",

"delay",
"sleep"
"sleep",
"ready"
],

@@ -44,5 +40,4 @@ "dependencies": {

"delay": "^2.0.0",
"execa": "^0.10.0",
"xo": "*"
}
}
# wait-for-localhost [![Build Status](https://travis-ci.org/sindresorhus/wait-for-localhost.svg?branch=master)](https://travis-ci.org/sindresorhus/wait-for-localhost)
> Wait for localhost to be ready from the command-line
> Wait for localhost to be ready
Useful if you need a local server to be ready to accept requests before executing the next command.
Useful if you need a local server to be ready to accept requests before doing other things.
I personally use this to wait for [`webpack-dev-server`](https://github.com/webpack/webpack-dev-server) to be ready before launching Electron.
## Install

@@ -20,15 +18,27 @@

```
$ wait-for-localhost --help
const waitForLocalhost = require('wait-for-localhost');
Usage
$ wait-for-localhost [port]
Example
$ wait-for-localhost 8080 && echo 'Server is ready'
(async () => {
await waitForLocalhost(8080);
console.log('Server is ready');
})();
```
## API
### waitForLocalHost([port])
Returns a `Promise` that settles when localhost is ready.
#### port
Type: `number`<br>
Default: `80`
## Related
- [delay-cli](https://github.com/sindresorhus/delay-cli) - Delay execution for a given amount of seconds
- [wait-for-localhost-cli](https://github.com/sindresorhus/wait-for-localhost-cli) - CLI for this module
- [delay](https://github.com/sindresorhus/delay) - Delay execution for a given amount of seconds

@@ -35,0 +45,0 @@

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