@zombienet/utils
Version:
Useful utilities for ZombieNet Framework
16 lines (15 loc) • 702 B
TypeScript
export interface GetRandomPortOptions {
maxRetries?: number;
timeout?: number;
}
/**
* Get a random available TCP port.
*
* Note that this function is prone to race conditions: a different process can start using the
* returned port before the caller of this function can start their server. However, in-process
* race conditions are prevented by storing the returned ports, so that a quick succession of
* calls to this function never returns a duplicate port.
*/
export declare function getRandomPort(options?: GetRandomPortOptions): Promise<number>;
export declare function getHostIp(): Promise<string>;
export declare function downloadFile(url: string, dest: string): Promise<void>;