Hello @kartik,
With Node.js v6 (and above) there is a dedicated os module, which provides a number of operating system-related utility methods.
On my Windows 10 machine it reports the following:
var os = require('os');
console.log(os.type()); // "Windows_NT"
console.log(os.release()); // "10.0.14393"
console.log(os.platform()); // "win32"
Hope It helps!!
Thank you!!