UNPKG

axiodb

Version:

A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern application. Supports schemas, encryption, and advanced query capabilities.

52 lines (51 loc) 1.86 kB
import { ServerKeys } from "./keys"; /** * Checks whether a specific port is already in use. * * @param port - The port number to check * @param host - The host to check the port on, defaults to localhost * @returns A Promise that resolves to true if the port is in use, false otherwise * @throws {Error} If the port is already in use * * @example * // Check if port 3000 is available * try { * const inUse = await isPortInUse(3000); * if (!inUse) { * // Port is free, can use it * } * } catch (error) { * console.error(error.message); * } */ export declare function isPortInUse(port: number, host?: ServerKeys): Promise<unknown>; /** * Checks if a specified port is currently mapped to any running Docker container. * * This function executes a Docker command to list all running containers and their port mappings, * then filters for containers that are using the specified port. * * @param port - The port number to check for Docker container mappings * @throws {Error} If the specified port is already mapped to a Docker container * @returns {Promise<void>} * * @example * ```typescript * try { * await checkDockerPortMapping(3000); * // Port 3000 is free for use * } catch (error) { * // Port 3000 is already in use by a Docker container * console.error(error.message); * } * ``` */ export declare function checkDockerPortMapping(port: number): Promise<void>; /** * Checks if a specified port is in use and if there's a Docker port mapping for that port. * * @param port - The port number to check * @returns A Promise that resolves when both port usage check and Docker port mapping check are complete * @throws May throw an error if the port is already in use or if there's a conflict with Docker port mappings */ export default function checkPortAndDocker(port: number): Promise<void>;