mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
Use os-utils
This commit is contained in:
parent
d71250914b
commit
d3883c8dca
@ -160,6 +160,7 @@
|
|||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"object-assign-deep": "0.4.0",
|
"object-assign-deep": "0.4.0",
|
||||||
"on-build-webpack": "0.1.0",
|
"on-build-webpack": "0.1.0",
|
||||||
|
"os-utils": "0.0.14",
|
||||||
"parse5": "5.0.0",
|
"parse5": "5.0.0",
|
||||||
"portscanner": "2.2.0",
|
"portscanner": "2.2.0",
|
||||||
"progress-bar-webpack-plugin": "1.11.0",
|
"progress-bar-webpack-plugin": "1.11.0",
|
||||||
|
@ -2,6 +2,7 @@ import * as os from 'os';
|
|||||||
import * as sysUtils from 'systeminformation';
|
import * as sysUtils from 'systeminformation';
|
||||||
import * as diskusage from 'diskusage';
|
import * as diskusage from 'diskusage';
|
||||||
import Xev from 'xev';
|
import Xev from 'xev';
|
||||||
|
const osUtils = require('os-utils');
|
||||||
|
|
||||||
const ev = new Xev();
|
const ev = new Xev();
|
||||||
|
|
||||||
@ -44,14 +45,12 @@ export default function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CPU STAT
|
// CPU STAT
|
||||||
async function cpuUsage() {
|
function cpuUsage() {
|
||||||
try {
|
return new Promise((res, rej) => {
|
||||||
const data = await sysUtils.currentLoad();
|
osUtils.cpuUsage((cpuUsage: number) => {
|
||||||
return Math.floor(data.currentload / 100);
|
res(cpuUsage);
|
||||||
} catch (error) {
|
});
|
||||||
console.error(error);
|
});
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MEMORY(excl buffer + cache) STAT
|
// MEMORY(excl buffer + cache) STAT
|
||||||
|
Loading…
Reference in New Issue
Block a user