Any idea how to set current RAM usage to a variable?


#1

I am creating a discord bot, and want to have a command to check current RAM usage (CPU and Disk are always near 0) or perhaps DM me when it gets above a certain amount.
Is there a way to do this or is there an NPM package to do that for me?


#2

You can read the contents of these two files:
/sys/fs/cgroup/memory/memory.limit_in_bytes
/sys/fs/cgroup/memory/memory.usage_in_bytes