New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

backgroundify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backgroundify

Use separate node processes to run long synchronous functions

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Backgroundify

Execute long synchronous functions in background node processes.

Sometimes you have a big long synchronous function (e.g. JavaScript compilation using UglifyJS) but you don't want it locking up the main thread of your node application.

Use backgroundify to move that function onto a background process.

Usage

backgroundify(pathToModule[, processTitle, numProcesses ])

  • pathToModule is evaluated relative to the file in which backgroundify is required
  • numProcess defaults to max(1, numCpus - 1)
// fn.js

module.exports = function(input){
  // do your synchronous stuff

  return output;
};
var backgroundify = requlre('backgroundify');

// Execute './path/to/fn' on up to 4 concurrent background processes
var fn = backgroundify('./path/to/fn', 'optional-process-title', 4);

fn(input, function(err, output){
  // if fn.js throws an error, err is set to that, otherwise null
  // output is whatever fn.js outputs
});

FAQs

Package last updated on 01 Mar 2014

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