@arrows/worker
Version:
Simple, promise-based API for native worker threads (with pools)
14 lines (13 loc) • 489 B
TypeScript
import { Transfer, transferKey } from "./types";
/**
* Wraps a worker handler so you can add a transfer list for the result.
*
* Works only if the result is an instance of a Buffer or a TypedArray.
*
* @param handler - Handler function
* @param mapperFn - Takes the result and should produce a transfer list.
* @returns A wrapped handler whose result will be moved rather than cloned.
*/
declare const transfer: Transfer;
export { transfer, transferKey };
export default transfer;