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

33 lines
640 B
JavaScript
Raw Normal View History

const WindowsPlatform = require('./platforms/windows');
const LinuxPlatform = require('./platforms/linux');
const DarwinPlatform = require('./platforms/darwin');
function getMethods() {
const classes = {
2018-04-10 19:44:46 +02:00
'win32': WindowsPlatform,
'linux': LinuxPlatform,
'android': LinuxPlatform,
'darwin': DarwinPlatform
};
return classes[process.platform];
}
const methods = getMethods();
function total() {
return methods.getTotalMemory();
}
function used() {
return methods.getUsedMemory();
}
function free() {
return methods.getFreeMemory();
}
module.exports = {total, used, free};