# workerize **Repository Path**: mirrors_developit/workerize ## Basic Information - **Project Name**: workerize - **Description**: 🏗️ Run a module in a Web Worker. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2025-12-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
# Workerize [](https://www.npmjs.org/package/workerize) [](https://travis-ci.org/developit/workerize)
> Moves a module into a Web Worker, automatically reflecting exported functions as asynchronous proxies.
- Bundles a tiny, purpose-built RPC implementation into your app
- If exported module methods are already async, signature is unchanged
- Supports synchronous and asynchronous worker functions
- Works beautifully with async/await
- Just **800 bytes** of gzipped ES3
## Install
```sh
npm install --save workerize
```
### Usage
Pass either a function or a string containing code.
**worker.js**:
```js
let worker = workerize(`
export function add(a, b) {
// block for half a second to demonstrate asynchronicity
let start = Date.now();
while (Date.now()-start < 500);
return a + b;
}
`);
(async () => {
console.log('3 + 9 = ', await worker.add(3, 9));
console.log('1 + 2 = ', await worker.add(1, 2));
})();
```
### License
[MIT License](https://oss.ninja/mit/developit/) © [Jason Miller](https://jasonformat.com)