evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
Create a small helper module that finds a single free TCP port. Provide both Promise-based and callback-based entry points so it can be used in asynchronous workflows that prefer either style. The lookup should start from a configurable base port and stop when the first available port is found within the allowed range.
startPort (default 8000) and within stopPort when provided. @teststartPort to stopPort. @teststopPort is lower than startPort. @testexport interface PortSearchOptions {
startPort?: number; // default 8000
stopPort?: number; // inclusive upper bound; optional
host?: string; // optional target host to target during lookup
}
export function findAvailablePort(options?: PortSearchOptions): Promise<number>;
export function findAvailablePortCallback(
options: PortSearchOptions,
callback: (err: Error | null, port?: number) => void
): void;Locates available TCP ports.