mirror of
https://git.fuwafuwa.moe/SMLoadrDev/SMLoadr
synced 2024-11-17 00:34:33 +01:00
33 lines
640 B
JavaScript
33 lines
640 B
JavaScript
const WindowsPlatform = require('./platforms/windows');
|
|
const LinuxPlatform = require('./platforms/linux');
|
|
const DarwinPlatform = require('./platforms/darwin');
|
|
|
|
|
|
function getMethods() {
|
|
const classes = {
|
|
'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};
|