UNPKG

@arrows/worker

Version:

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

15 lines (12 loc) 323 B
const { worker } = require("@arrows/worker") /** * This payload is not cloned, the underlying memory is moved, * see caller code to check how it's done. * * @param {Uint8Array} payload * @returns {number} */ const handler = (payload) => { return payload.reduce((a, b) => a + b) } module.exports = worker(handler)