multiprocess-map
TypeScript icon, indicating that this package has built-in type declarations

1.5.3 • Public • Published

multiprocess-map

Build Status Coverage Status

NOTE: For node 0.10 up to 6.0 support use versions up to 1.4.3. These versions don't support the browser like the most current one does.

Runs a map function on a set of values. The function will run on as many processors your machine has, or on max processes.

Works in the browser, using web workers instead of node forks.

async map(values, fn[,{ max = os.cpus().length, processStdout:(cpStdout) => stdoutModified}])

Returns a promise for the mapped array.

Use processStdout option to process the stdout before multiprocess-map prints it to the console. Do this if the stdout is too verbose, for example.

const map = require('multiprocess-map')  // Works with node 0.10 -> 10
 
async function main() {
  await map([1, 2], async (value, i, all) => await foo(value))
}

Dependents (1)

Package Sidebar

Install

npm i multiprocess-map

Weekly Downloads

25

Version

1.5.3

License

MIT

Unpacked Size

13.8 kB

Total Files

7

Last publish

Collaborators

  • fabiosantoscode