Skip to main content
Cluster.worker - node__cluster.d.ts - Node documentation
property Cluster.worker

Usage in Deno

```typescript import { type Cluster } from "node:node__cluster.d.ts"; ```
A reference to the current worker object. Not available in the primary process. ```js import cluster from 'node:cluster'; if (cluster.isPrimary) { console.log('I am primary'); cluster.fork(); cluster.fork(); } else if (cluster.isWorker) { console.log(`I am worker #${cluster.worker.id}`); } ```

Type

Worker | undefined