Returns true if current process is master when running Node app in cluster mode.
Install with npm:
$ npm install --save is-master-process
While Node's cluster API offers a simple way to check if a process is master, there are instances where you won't directly call the API. For example, if running in cluster mode in PM2.
This module helps identify the master process in one line of code.
const isMasterProcess = require('is-master-process')
if (isMasterProcess) {
console.log('PID:', process.pid, 'is master')
}