Check PC specs?

Hi, dear forum!
Is there a way to verify the PC specifications and store them in a variable?
I.e to check the amount of RAM in the system and store that amount in a var?
I think it would be useful to adapt some not essential processes according to the system specifications (like a lighter version of the game).
well there is navigator.deviceMemory but it's not very exact, should show you if someone has low memory, though i've never tested it to make sure on a low end machine.

I have 32GB of ram in my pc and navigator.deviceMemory shows as 8GB.

navigator.hardwareConcurrency would return the number of cpu threads

not sure you can pull much more than that, maybe someone else would know.
Maybe you can use below functions of os module in NW.js

docs link : https://nodejs.org/api/os.html

JavaScript:
os.totalmem();
os.freemem();
os.cpus();

// For example
var currentMem = (os.totalmem() - os.freemem()) / Math.pow(1024, 3);
var totalMem = os.totalmem() / Math.pow(1024, 3);
Maybe you can use below functions of os module in NW.js

docs link : https://nodejs.org/api/os.html

JavaScript:
os.totalmem();
os.freemem();
os.cpus();

// For example
var currentMem = (os.totalmem() - os.freemem()) / Math.pow(1024, 3);
var totalMem = os.totalmem() / Math.pow(1024, 3);
Thanks for your answer!
I'm not good with jscript so, just to clear my mind, the first line in your example check for actual free memory, and the second one for total memory? And put them in variable 3?
:LZSteary: sorry, I really appreciate your help but I need some more info on how it works...
Thanks for your answer!
I'm not good with jscript so, just to clear my mind, the first line in your example check for actual free memory, and the second one for total memory? And put them in variable 3?
:LZSteary: sorry, I really appreciate your help but I need some more info on how it works...

It is pretty easy.
In the script command, you need to write below code block.

JavaScript:
var os = require('os');

var divValue = Math.pow(1024, 3);
var currentMem = (os.totalmem() - os.freemem()) / divValue;
var totalMem = os.totalmem() / divValue;

$gameVariables.setValue(3, currentMem.toFixed(1));
$gameVariables.setValue(4, totalMem.toFixed(1));
It is pretty easy.
In the script command, you need to write below code block.

JavaScript:
var os = require('os');

var divValue = Math.pow(1024, 3);
var currentMem = (os.totalmem() - os.freemem()) / divValue;
var totalMem = os.totalmem() / divValue;

$gameVariables.setValue(3, currentMem.toFixed(1));
$gameVariables.setValue(4, totalMem.toFixed(1));
That's great!
Just one last thing if you can help; how can I store in variables informations from os.cpus?
with:
var os = require("os")
$gameVariables.setValue(1, os.cpus())
it shows only [object Object]

However thank you so much^^
That's great!
Just one last thing if you can help; how can I store in variables informations from os.cpus?
with:
var os = require("os")
$gameVariables.setValue(1, os.cpus())
it shows only [object Object]

However thank you so much^^
'os.cpus()' returns an Array object so you need to enumerate one by one.
(Note that this code block is worked only in NW.js such as Mac, Windows platform)
Try this out.

JavaScript:
var os = require('os');
var cpu = os.cpus().pop();
$gameVariables.setValue(5, cpu.model); // CPU MODEL
$gameVariables.setValue(6, os.cpus().length); // CPU CORE COUNT
'os.cpus()' returns an Array object so you need to enumerate one by one.
(Note that this code block is worked only in NW.js such as Mac, Windows platform)
Try this out.

JavaScript:
var os = require('os');
var cpu = os.cpus().pop();
$gameVariables.setValue(5, cpu.model); // CPU MODEL
$gameVariables.setValue(6, os.cpus().length); // CPU CORE COUNT
Perfect!
Thank you again

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/check-pc-specs.121760/