In node.js you can kick off several asynchronous functions at one time and then have them return the results to a function when they're all complete: understanding-node-js-async-parallel
In PowerShell I've seen a similar functionality using Start-Job
but! when actually trying to run the tasks they seem to lag too much to be non-blocking and being started in parallel:
Write-Host "Running jobs $($start) - $($end)"
for($i = [int]$start; $i -le $end; $i++) {
$jobResults += Start-Job -ScriptBlock $someFunc | wait-job | receive-job
}
I believe this stems from the wait-job
function which waits for the kicked off job to complete before receiving it.
Is there a way to wait for all of them and receive them into an array like node async does? Or am I looking at apples and oranges here?