I want to make a command called _ram it should display the current usage of the bots ram. I already tried these things:
${client.performance.memory} //(Says memory is not defined)
${window.performance.memory} //(Window is not defined)
Is there a working way how to display it?
If you want to know how much memory your Node.js process is using, you can query:
process.memoryUsage().heapUsed / 1024 / 1024;
It will output the memory used by your process in bytes. It won't show the real memory used by Node.js, as in that case you also need to take into account Node.js garbage collector.
var os = require('os');
var usedMemory = os.totalmem() -os.freemem(), totalMemory = os.totalmem();
var getpercentage =
((usedMemory/totalMemory) * 100).toFixed(2) + '%'
console.log("Memory used in GB", (usedMemory/ Math.pow(1024, 3)).toFixed(2))
console.log("Used memory" , getpercentage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With