UNPKG

@arrows/worker

Version:

Simple, promise-based API for native worker threads (with pools)

16 lines (12 loc) 264 B
const myWorker = require("./myWorker") const main = async () => { try { const result = await Promise.all( Array.from({ length: 20 }, (_, i) => myWorker(i)), ) console.log({ result }) } catch (error) { console.log("Oops!") } } main()