worker-fns

0.2.0 • Public • Published

worker-fns

Collection of Modern Worker Utility Functions

features

  • modern ES6 syntax
  • cross-platform (works on the Web and in NodeJS)
  • automatically create transfer list

functions

Documentation for the following can be found here

install

npm install worker-fns

simple example

import { postMessageWithAutoTransfer } from 'worker-fns';

const worker = new Worker("./worker.js");
const response = await fetch("./example.dat");
const data = await response.arrayBuffer();

// automatically transfer ownership of array buffer
// to the worker thread avoiding unecessarily copying the data
postMessageWithAutoTransfer(worker, data);

Package Sidebar

Install

npm i worker-fns

Weekly Downloads

3

Version

0.2.0

License

CC0-1.0

Unpacked Size

12.7 kB

Total Files

11

Last publish

Collaborators

  • danieljdufour