Create type definition for 'os-utils' (#4050)

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-02-03 23:41:27 +09:00 committed by Aya Morisawa
parent fe13c17fcb
commit 893a3b527d
2 changed files with 31 additions and 1 deletions

30
src/@types/os-utils.d.ts vendored Normal file
View file

@ -0,0 +1,30 @@
declare module 'os-utils' {
type FreeCommandCallback = (usedmem: number) => void;
type HarddriveCallback = (total: number, free: number, used: number) => void;
type GetProcessesCallback = (result: string) => void;
type CPUCallback = (perc: number) => void;
export function platform(): NodeJS.Platform;
export function cpuCount(): number;
export function sysUptime(): number;
export function processUptime(): number;
export function freemem(): number;
export function totalmem(): number;
export function freememPercentage(): number;
export function freeCommand(callback: FreeCommandCallback): void;
export function harddrive(callback: HarddriveCallback): void;
export function getProcesses(callback: GetProcessesCallback): void;
export function getProcesses(nProcess: number, callback: GetProcessesCallback): void;
export function allLoadavg(): string;
export function loadavg(_time?: number): number;
export function cpuFree(callback: CPUCallback): void;
export function cpuUsage(callback: CPUCallback): void;
}

View file

@ -3,7 +3,7 @@ import * as sysUtils from 'systeminformation';
import * as diskusage from 'diskusage';
import * as Deque from 'double-ended-queue';
import Xev from 'xev';
const osUtils = require('os-utils');
import * as osUtils from 'os-utils';
const ev = new Xev();