What is the os module in Node.js?

Answer

The os module provides operating system-related utility methods and properties. Key features: os.platform() — returns the OS platform: "linux", "darwin" (macOS), "win32"; os.arch() — CPU architecture: "x64", "arm64"; os.cpus() — array of CPU core info (model, speed, times); os.freemem() / os.totalmem() — free and total system memory in bytes; os.hostname() — machine hostname; os.userInfo() — current user info (username, homedir); os.homedir() — home directory path; os.tmpdir() — default temp directory path; os.networkInterfaces() — network interfaces with IP addresses; os.uptime() — system uptime in seconds; os.EOL — OS-specific line ending (\r\n on Windows, \n on Unix). Useful for writing cross-platform CLI tools and system monitoring utilities.