1
0
mirror of https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr synced 2024-11-15 00:34:32 +01:00
SMLoadr/libs/node-memory-stats/platforms/windows.js

16 lines
510 B
JavaScript

const exec = require('child_process').execSync;
module.exports = class Windows {
static getTotalMemory() {
return parseInt(exec('wmic OS get TotalVisibleMemorySize /value', {'encoding': 'utf8'}).trim().split('=')[1], 10) * 1024;
}
static getUsedMemory() {
return this.getTotalMemory() - this.getFreeMemory();
}
static getFreeMemory() {
return parseInt(exec('wmic OS get FreePhysicalMemory /value', {'encoding': 'utf8'}).trim().split('=')[1], 10) * 1024;
}
};