type method of OS module of node.js


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 :


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


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