Basic usage - threads.js
https://threads.js.org/usageType-safe workers. When using TypeScript you can declare the type of a spawn () -ed worker: // master.ts import { spawn, Thread, Worker } from "threads" type HashFunction = (input: string) => Promise<string> const sha512 = await spawn<HashFunction>(new Worker("./workers/sha512")) const hashed = await sha512("abcdef") It’s also easy to export ...