multiprocess-map

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.

Usage no npm install needed!

<script type="module">
  import multiprocessMap from 'https://cdn.skypack.dev/multiprocess-map';
</script>

README

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))
}