Introduction
This article explains the Process object in Node.js. Node.js is a server-side JavaScript lannguage written using the Google V8 engine. The main purpose of Node.js is that system interaction should be non-blocking or asynchrounous.
Process Object
The process object is the global object in Node. It can be accessed from anywhere; it is an instance of EventEmitter. Each Node.js has a set of built-in functionality, accessible through the global process object. The process object provides the standard input/output (stdio) streams stdin, stdout and stderr (as in C/C++) as in the following:
- stdin: a readable stream for reading input from the user.
- stdout: a writable stream, either synchrously or asynchronously.
- stderr: a blocking synchronous writable stream intended for error messages.
The stdout or non-blocking function are: console.log, console.info, util.puts, util.print and Stderr. The blocking funcitons are: console.warn, console.error, util.debug and process.stdin (a readable stream for getting user input).
Properties of Process Object
- process.title: By default a process title is NODE but you can change it.
![]()
![]()
- process.pid: It's OS process ID.
![]()
![]()
- process.version: The version refers to your current node version. It's compiled in a property that represents the NODE version.
![Version]()
![versioncmd]()
- process.platform: The platform has the platform that your node is running in; it specifies the platform your process is running in, for example 'linux', 'win32', 'freebsd', 'sunos'.
![platform]()
![platformcmd]()
Summary
This article has explained the Process object and some of the properties of the Process object.