The Wayback Machine - https://web.archive.org/web/20240118175048/https://www.geeksforgeeks.org/node-js-os-complete-reference/
Open In App
Related Articles

Node.js OS Complete Reference

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Node.js OS module provides information about the computer operating system.

Below example illustrate the os.version() method in Node.js:

Example:

Javascript




// Import the os module
const os = require("os");
 
let osVersion = os.version();
console.log("OS Version:", osVersion);


Output:

OS Version: Windows 10 Enterprise

The Complete list of OS are listed below:

NodeJS OS

Node.js OS 

Description

Node.js os.EOL This is used to get end-of-line characters or markers as specified by the operating system.
Node.js os.arch() Method This is used to get the CPU architecture of the computer for which the current node.js is compiled.
Node.js os.cpus() Method This is used to get information about each logical CPU core of the computer.
Node.js os.endianness() Method This is used to get endianness of the CPU of the computer for which the node.js is compiled.
Node.js os.freemem() Method This is used to get the amount of free system memory.
Node.js os.getPriority() Method This is used to get the scheduling priority of the process specified by pid.
Node.js os.homedir() Method This is used to get path of the home directory for the current user.
Node.js os.hostname() Method This is used to get hostname of the operating system.
Node.js os.loadavg() Method This is used to get the load average.
Node.js os.networkInterfaces() Method  This is used to get information about the network interfaces of the computer.
Node.js os.platform() Method This is used to get the Operating system platform.
Node.js os.release() Method This is used to get the Operating system release.
Node.js os.setPriority() Method This is used to set the scheduling priority of the process specified by pid and priority.
Node.js os.tmpdir() Method This is used to get path of default directory for temporary files of the operating system.
Node.js os.totalmem() Method This is used to get the amount of total system memory in bytes.
Node.js os.type() Method This is used to get the Operating system name.
Node.js os.uptime() Method This is used to get system uptime in seconds.
Node.js os.userInfo() Method This is used to get the information of the currently effective user.
Node.js os.version() Method The os. version() method is used to identify the version of the kernel of the Operating System.

NodeJS OS Constants

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 07 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials