get os node js code example Example 1: import os js import os from 'os'; Example 2: how to check platform in nodejs var isWin = process.platform === "win32";