# node-cluster-client

> nodejs cluster client based on node-ipc and proxy

Latest version **1.0.0** (published 2018-02-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-cluster-client
pnpm add node-cluster-client
yarn add node-cluster-client
bun add node-cluster-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-02-24 |
| First published | 2018-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | catlite1991 |

## Links

- npm: https://www.npmjs.com/package/node-cluster-client
- npm.io page: https://npm.io/package/node-cluster-client

## Dependencies (1)

- [node-ipc](https://npm.io/package/node-ipc.md) ^9.1.1

## Recent versions

- 1.0.0 (latest) — 2018-02-24

## README

```javascript
import * as os from 'os'
import * as cluster from 'cluster'
import ClusterClient from 'cluster-client'

const forkNum = os.cpus().length <= 3 ? 3 : os.cpus().length
    if (cluster.isMaster) {
      ClusterClient.initMaster()
      for (let i = 0; i < forkNum; i++) {
        cluster.fork()
      }
      ...
    } else {
      ClusterClient.initWorker()
      ...
    }
```

```javascript
import Redis from 'ioredis'

// will return the real instance in the leader process
// and the empty object which proxy to the real instance via node-ipc
const myClusterRedis = new ClusterClient(Redis).create(option)
```

---
_Source: https://npm.io/package/node-cluster-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
