🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

run-parallel

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-parallel

Run an array of functions in parallel

1.2.0
latest
Version published
Weekly downloads
53M
-0.58%
Maintainers
1
Weekly downloads
 
Created

What is run-parallel?

The run-parallel npm package is designed to run multiple functions in parallel, without waiting until the previous function has completed. It is particularly useful for executing asynchronous tasks concurrently, such as I/O operations, in an efficient manner. Once all tasks have completed, a final callback is called with the results of each task.

What are run-parallel's main functionalities?

Running multiple asynchronous tasks in parallel

This feature allows for executing multiple asynchronous tasks concurrently. The code sample demonstrates how to use run-parallel to execute two tasks in parallel, each completing at different times but being processed together.

const runParallel = require('run-parallel')

const tasks = [
  function(callback) {
    setTimeout(function() {
      callback(null, 'one')
    }, 200)
  },
  function(callback) {
    setTimeout(function() {
      callback(null, 'two')
    }, 100)
  }
]

runParallel(tasks, function(err, results) {
  console.log(results) // ['one', 'two']
})

Other packages similar to run-parallel

FAQs

Package last updated on 10 Feb 2021

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