uptime method of OS module of node.js


Overview

This method is used to get the system uptime in seconds.
This method returns Integer . Code snippet is given below :

Code


													
//Name of the file: uptime.js
var os = require('os');
var value =  os.uptime();
console.log("os.uptime() => " + value);			
													
												

Run

  • Now run the snippet using the following command :
    													
    >node uptime.js
    os.uptime() => 22906.6507529