NodeJS is a powerful for tooling and creating script. NodeJS helps in automation of boring manual tasks.
NodeJS has lot of built-in packages and it is hard to pick which is the most powerful as all are equally important and powerful.
I will be sharing a series of post on each module. Starting from 'OS'.
What?
OS (operating system)
Use OS when you need information of the underlying operating System. This is pretty helpful when you are running your project on different platforms or beyond just web.
How to use it?
Just require it in your file.
const os = require('os')
Methods
OS has a lot of methods. Here a few common ones :
os.arch() // Returns the operating system CPU architecture
os.platform() // Returns information about the operating system's platform
os.userInfo() // Returns information about the current user
os.totalmem() // Returns the number of total memory of the system
os.freemem() // Returns the number of free memory of the system
Thanks for reading!! PS: Do check official document of the NodeJS for OS Module.
Next we will explore 'fs'
Top comments (0)