Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /**
|
---|
2 | * portfinder.js typescript definitions.
|
---|
3 | *
|
---|
4 | * (C) 2011, Charlie Robbins
|
---|
5 | */
|
---|
6 |
|
---|
7 | type PortfinderCallback = (err: Error, port: number) => void;
|
---|
8 |
|
---|
9 | interface PortFinderOptions{
|
---|
10 | /**
|
---|
11 | * Host to find available port on.
|
---|
12 | */
|
---|
13 | host?: string;
|
---|
14 | /**
|
---|
15 | * search start port (equals to port when not provided)
|
---|
16 | * This exists because getPort and getPortPromise mutates port state in
|
---|
17 | * recursive calls and doesn't have a way to retrieve begininng port while
|
---|
18 | * searching.
|
---|
19 | */
|
---|
20 | startPort?: number;
|
---|
21 | /**
|
---|
22 | * Minimum port (takes precedence over `basePort`).
|
---|
23 | */
|
---|
24 | port?: number;
|
---|
25 | /**
|
---|
26 | * Maximum port
|
---|
27 | */
|
---|
28 | stopPort?: number;
|
---|
29 | }
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The lowest port to begin any port search from.
|
---|
33 | */
|
---|
34 | export let basePort: number;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Responds with a unbound port on the current machine.
|
---|
38 | */
|
---|
39 | export function getPort(callback: PortfinderCallback): void;
|
---|
40 | export function getPort(options: PortFinderOptions, callback: PortfinderCallback): void;
|
---|
41 |
|
---|
42 | export function getPorts(count: number, options: PortFinderOptions, callback: (err: Error, ports: Array<number>) => void): void;
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Responds a promise of an unbound port on the current machine.
|
---|
46 | */
|
---|
47 | export function getPortPromise(options?: PortFinderOptions): Promise<number>;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.