lup-system
Version:
NodeJS library to retrieve system information and utilization.
41 lines (40 loc) • 1.54 kB
TypeScript
/**
* Runs a shell command and returns the output.
*
* @param command Command to execute in the shell.
* @returns Stdout and stderr output of the command.
*/
export declare function execCommand(command: string): Promise<string>;
/**
* Parses a byte value from a string.
*
* @param value String representation of a byte value (e.g., "100MB", "2GB").
* @returns The parsed byte value as a number.
*/
export declare function parseByteValue(value: string): number;
/**
* Tries to parse a string as a date.
*
* @param dateString String to parse as a date.
* @returns Date object if parsing is successful, otherwise null.
*/
export declare function parseDate(dateString: string): Date | null;
/**
* Processes a string of key-value pairs separated by a specified separator.
* Values can be values, strings, numbers, dates, or JSON objects/arrays.
*
* @param keyValueString String to process containing key-value pairs.
* @param pairSeparator The separator between key-value pairs (default is ',').
* @param keyValueSeparator The separator between keys and values (default is '=').
* @returns An object with keys and their corresponding values.
*/
export declare function processKeyValueString(keyValueString: string, pairSeparator?: string, keyValueSeparator?: string): {
[key: string]: any;
};
/**
* Pauses execution for a specified duration.
*
* @param ms Duration to sleep in milliseconds.
* @returns A promise that resolves after the specified duration.
*/
export declare function sleep(ms: number): Promise<void>;