MCPcopy Index your code
hub / github.com/modstart-lib/aigcpanel / getAvailablePort

Function getAvailablePort

electron/mapi/httpserver/main.ts:21–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19let runningToken = "";
20
21const getAvailablePort = (): Promise<number> => {
22 return new Promise((resolve, reject) => {
23 const s = http.createServer();
24 s.listen(0, "127.0.0.1", () => {
25 const addr = s.address() as { port: number };
26 const port = addr.port;
27 s.close(() => resolve(port));
28 });
29 s.on("error", reject);
30 });
31};
32
33const generateToken = (): string => {
34 return (

Callers 1

startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected