UNPKG

@kotori-bot/tools

Version:
18 lines (17 loc) 1.14 kB
/// <reference types="node" /> import type { JsonMap } from '../types'; import { type ExecException, type ExecOptions } from 'node:child_process'; type ConfigFileType = 'json' | 'toml' | 'yaml' | 'yml' | 'text'; export declare const configFileType: readonly ["json", "toml", "yaml", "yml", "text"]; export declare function loadConfig<T extends ConfigFileType = 'json'>(filename: string, type?: T, init?: (T extends 'text' ? string : object) | undefined): T extends 'text' ? string : JsonMap; export declare function saveConfig(filename: string, data: object | string, type?: ConfigFileType): void; export declare function createConfig(filename: string, data?: object, type?: ConfigFileType): void; export declare function supportTs(): boolean; /** * Executes a command as a child process and streams its output. * * @param command - The command to execute * @returns A Promise that resolves with the ChildProcess object */ export declare function executeCommand(command: string, options?: ExecOptions, callback?: (error?: ExecException | null, stdout?: string, stderr?: string) => void): import("child_process").ChildProcess; export {};