(path: string)
| 448 | * Return a promise that resolves with whether the socket path is active. |
| 449 | */ |
| 450 | export function canConnect(path: string): Promise<boolean> { |
| 451 | return new Promise((resolve) => { |
| 452 | const socket = net.connect(path) |
| 453 | socket.once("error", () => resolve(false)) |
| 454 | socket.once("connect", () => { |
| 455 | socket.destroy() |
| 456 | resolve(true) |
| 457 | }) |
| 458 | }) |
| 459 | } |
| 460 | |
| 461 | export const isFile = async (path: string): Promise<boolean> => { |
| 462 | try { |
no test coverage detected