![]() |
VOOZH | about |
The os.totalmem() method is an inbuilt application programming interface of the os module which is used to get the amount of total system memory in bytes.
Syntax:
os.totalmem()
Parameters: This method does not accept any parameters.
Return Value: This method returns an integer value that specifies the amount of total system memory in bytes.
Example 1: The below example illustrates the use of os.totalmem() method in Node.js:
Output:
8502722560
Example 2: The below example illustrates the use of the os.totalmem() method in Node.js:
Output:
Total memory: 7GB 940MB 848KB and 0Bytes
Example 3: The below example illustrates the use of the os.totalmem() method in Node.js:
Output:
Free Memory 4161896448 Bytes out of 8502722560 Bytes
Note: The above program will compile and run by using the node index.js command.