type method of OS module of node.js


Overview

This method of os module of node.js is used to get the operating system name as returned by Uname.
Common values are :

  • 'Windows_NT' : on Windows
  • 'Linux' : on Linux
  • 'debian' : on MacOS
This method returns String . Code snippet is given below :

Code


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

Run

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