Skip to main content

Function: getFreePort()

getFreePort(port): Promise<number>

Defined in: packages/extension-api/src/extension-api.d.ts:4927

Finds a free port starting from the specified port and returns it.

Parameters

port

number

The starting port number to search for a free port. Must be between 0 and 65535. If less than 1024, it defaults to 9000.

Returns

Promise<number>

A promise that resolves to a free port number.

Throws

Error if the port is invalid (NaN or > 65535) or if no free port is found within the valid range (0-65535).