source: trip-planner-front/node_modules/portfinder/lib/portfinder.d.ts@ e29cc2e

Last change on this file since e29cc2e 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
7type PortfinderCallback = (err: Error, port: number) => void;
8
9interface 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 */
34export let basePort: number;
35
36/**
37 * Responds with a unbound port on the current machine.
38 */
39export function getPort(callback: PortfinderCallback): void;
40export function getPort(options: PortFinderOptions, callback: PortfinderCallback): void;
41
42export 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 */
47export function getPortPromise(options?: PortFinderOptions): Promise<number>;
Note: See TracBrowser for help on using the repository browser.