platform method of OS module of node.js


Overview

This method is used to get the operating system platform as set during compile time of node.js .
Possible values are :

  • 'win32'
  • 'aix'
  • 'freebsd'
  • 'linux'
  • 'openbsd'
  • 'darwin'
  • 'sunos'
This method returns String . Code snippet is given below :

Code


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

Run

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