This article is a gentle introduction to some Node.js fundamentals. Feel encouraged to open up a Unix-like operating system and run the code using the command “node yourFile.js”.
We will cover:
The process Object
Events
Streams and STDIO
What is a process? A process is an instance of a program that is being processed by a processor. A process has many properties. Node.js introduces the process object to reveal process properties.
//Here we count 'keys' of the process object.
"use strict";
console.log(Object.keys(process).length); //68
As you can see, this instance of the process object has 68 properties.
68
As shown below, we can check the process ID and the processes memory usage.
"use strict";
console.log(process.pid);
console.table(process.memoryUsage());
#javascript #programming #nodejs