OS module in node js

Os module in nodejs

What is os module in node js? What is it's use?
OS stands for Operating system. This module provides information on your operating system.Everybody must be knowing what are operating systems. An operating system (os) is a system software that manages computer hardware ,software etc. Examples of operating system are widows , mac etc. So, basically this module gives details about your operating system like architecture, hostname etc. Imagine you don't know the architecture of your os. In order to find it we need to go to device manager & bla bla bla(I actually don't know). This process is too long like I have used this process(Googled it actually)several times but still don't know it. But writing only line of code in node js you can know what is the architecture of your os . As we know, before using any module in node js we need to require it.

const os = require ("os");

To get cpu architecture 

os.arch();

To know how much free system  memory you have  (in bytes)
 
os.freemem();

To know the total memory (in bytes)

os.totalmem();

To know the hostname 
os.hostname();

To know the os platform  platform which you are using
os.platform();

To know os type 
os.type();

To know kernel version
os.version();


I have explained fs module in node js in my previous blogs. I will provide the link below. Also, I will provide the link of official node js documentation to get more info on os module.

Link to my previous blog.
https://pirogrammer1.blogspot.com/2021/04/fs-module-in-node-js-asynchronous.html

Link to nodejs official documentation
Click here

Comments

Post a Comment

Popular posts from this blog

Fs module in node js!!!

Open source !!

Programming communities