wait-for-localhost
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
48
3109
16