is-master-process

1.0.1 • Public • Published

is-master-process NPM version NPM monthly downloads NPM total downloads

Returns true if current process is master when running Node app in cluster mode.

Install

Install with npm:

$ npm install --save is-master-process

Why is this needed?

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.

Usage

const isMasterProcess = require('is-master-process')

if (isMasterProcess) {
  console.log('PID:', process.pid, 'is master')
}

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i is-master-process

      Weekly Downloads

      0

      Version

      1.0.1

      License

      MIT

      Unpacked Size

      3.3 kB

      Total Files

      4

      Last publish

      Collaborators

      • r3dh4r7