![]() |
VOOZH | about |
The os.freemem() method is an inbuilt application programming interface of the os module which is used to get the amount of free system memory.
Syntax:
os.freemem()
Parameters: This method does not accept any parameters.
Return Value: This method returns an integer value that specifies the amount of free system memory in bytes.
Example 1: The below example illustrates the use of os.freemem() method in Node.js:
Output:
4158910464
Example 2: The below example illustrates the use of os.freemem() method in Node.js:
Output:
Free memory: 4GB 110MB 88KB and 0Bytes
Note: The above program will compile and run by using the node index.js command.
Reference: https://nodejs.org/api/os.html#os_os_freemem