Wait-on

wait-on

wait for files, ports, sockets, http(s) resources.

wait-on is a cross-platform command line and API utility which will wait for files, ports, sockets, and http(s) resources to become available (or not available using reverse mode).

Get it: npm install [-g] wait-on

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
wait-on file1 && NEXT_CMD # wait for file1, then exec NEXT_CMD 

wait-on f1 f2 && NEXT_CMD # wait for both f1 and f2, the exec NEXT_CMD 

wait-on http://localhost:8000/foo && NEXT_CMD # wait for http 2XX HEAD 

wait-on https://myserver/foo && NEXT_CMD # wait for https 2XX HEAD 

wait-on http-get://localhost:8000/foo && NEXT_CMD # wait for http 2XX GET 

wait-on https-get://myserver/foo && NEXT_CMD # wait for https 2XX GET 

wait-on tcp:4000 && NEXT_CMD # wait for service to listen on a TCP port

wait-on socket:/path/mysock # wait for service to listen on domain socket 

wait-on http://unix:/var/SOCKPATH:/a/foo # wait for http HEAD on domain socket 

wait-on http-get://unix:/var/SOCKPATH:/a/foo # wait for http GET on domain socket 
1
2
3
4
5
6
try {
  await waitOn(opts);
  // once here, all resources are available
} catch (err) {
  handleError(err);
}

GIF FTW!

wait-on

Suggest a module

Comments