File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed
Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 1+ interface Options {
2+ /**
3+ Milliseconds to wait before giving up.
4+
5+ @default 1000
6+ */
7+ timeout ?: number ;
8+
9+ /**
10+ Can be a domain or an IP.
11+
12+ @default 'localhost'
13+ */
14+ host ?: string ;
15+ }
16+
17+ /**
18+ Check if a local or remote port is reachable.
19+
20+ @example
21+ ```
22+ import isPortReachable from 'is-port-reachable';
23+
24+ if(await isPortReachable(3000)) {
25+ // start server
26+ }
27+ ```
28+ */
29+ declare function isPortReachable ( port : number , options ?: Options ) : Promise < boolean > ;
30+
31+ export = isPortReachable ;
Original file line number Diff line number Diff line change 1+ import { expectType } from 'tsd' ;
2+ import isPortReachable = require( '.' ) ;
3+
4+ expectType < boolean > ( await isPortReachable ( 3000 ) ) ;
Original file line number Diff line number Diff line change 1616 "node" : " >=8"
1717 },
1818 "scripts" : {
19- "test" : " xo && ava"
19+ "test" : " xo && ava && tsd "
2020 },
2121 "files" : [
22- " index.js"
22+ " index.js" ,
23+ " index.d.ts"
2324 ],
2425 "keywords" : [
2526 " port" ,
4041 ],
4142 "devDependencies" : {
4243 "ava" : " ^2.4.0" ,
43- "xo" : " ^0.25.3"
44+ "xo" : " ^0.25.3" ,
45+ "tsd" : " ^0.17.0"
4446 }
4547}
You can’t perform that action at this time.
0 commit comments