Skip to content

parallel

Executes many async functions in parallel. Returns the results from all functions as an array. After all functions have resolved, if any errors were thrown, they are rethrown in an instance of AggregateError.

Usage

// Process images concurrently, resizing each image to a standard size.
const images = await parallel(2, imageFiles, async (file) => {
return await resizeImage(file);
});

Installation

Terminal window
npx atmx add helper parallel