Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-nodejs-threader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-nodejs-threader

A simple collection of multi-threading helpers for NodeJs

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
272
increased by44.68%
Maintainers
1
Weekly downloads
 
Created
Source

simple-nodejs-threader

A basic package for multithreading (multiple processes) in NodeJs

Why

To simplify node build processes, used for better development experience or to spead up build pipelines, by utilizing node's multicore processing.

Download

  • With yarn: yarn add -D simple-nodejs-threader
  • With npm: npm install simple-nodejs-threader --save-dev

Getting started

  1. Create a new Process manager
const manager = new ProcessManager("My task name");
  1. Create one or more processes that can run in parallel
const backendProcess = ProcessManager.promiseSpawn(
  "yarn start:backend",
  [processFlags],
  {
    stdio: "inherit",
    shell: true,
  }
);

const frontendProcess = ProcessManager.promiseSpawn(
  "yarn start:frontend",
  [processFlags],
  {
    stdio: "inherit",
    shell: true,
  }
);
  1. Add processes to the manager queue
manager.queue(frontendProcess, backendProcess);
  1. Await for completion
await manager.complete();

Utils

addFlags

Convert an object into Node friendly process flags.

Arguments
  • flags [Record<string, string>]
Usage
const processFlags = addFlags({ argOne: "hello", argTwo: "world" });
processFlags; // [--hello, --world]

Keywords

FAQs

Package last updated on 11 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc