axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
30 lines (29 loc) • 1.1 kB
TypeScript
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 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>;