how to check platform in nodejs

// Step 1: Import the 'os' module
const os = require('os');

// Step 2: Use the 'platform()' method from the 'os' module
const platform = os.platform();

// Step 3: Check the platform and log the result
if (platform === 'darwin') {
  console.log('Platform is macOS');
} else if (platform === 'win32') {
  console.log('Platform is Windows');
} else if (platform === 'linux') {
  console.log('Platform is Linux');
} else {
  console.log('Platform is not recognized');
}