{"id":15762046,"url":"https://github.com/aromalanil/worker-man","last_synced_at":"2026-01-24T04:33:30.440Z","repository":{"id":67963317,"uuid":"603660216","full_name":"aromalanil/worker-man","owner":"aromalanil","description":"A simple \u0026 better API to consume worker threads in node.js","archived":false,"fork":false,"pushed_at":"2023-02-21T12:35:09.000Z","size":38,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-21T11:58:12.880Z","etag":null,"topics":["node-js","node-library","nodejs","npm","npm-package","worker-threads"],"latest_commit_sha":null,"homepage":"https://npmjs.com/worker-man","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aromalanil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["aromalanil"],"patreon":null,"open_collective":null,"ko_fi":"aromalanil","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://paypal.me/aromalanil","https://www.buymeacoffee.com/aromalanil"]}},"created_at":"2023-02-19T07:23:45.000Z","updated_at":"2024-10-18T22:33:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"698100f8-0396-4fd3-8ff7-64cb420ad20b","html_url":"https://github.com/aromalanil/worker-man","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"2f84c801c323b186eb553f74ebddae7603d703c9"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aromalanil/worker-man","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aromalanil%2Fworker-man","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aromalanil%2Fworker-man/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aromalanil%2Fworker-man/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aromalanil%2Fworker-man/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aromalanil","download_url":"https://codeload.github.com/aromalanil/worker-man/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aromalanil%2Fworker-man/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28711526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T23:51:44.727Z","status":"online","status_checked_at":"2026-01-24T02:00:06.909Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-js","node-library","nodejs","npm","npm-package","worker-threads"],"created_at":"2024-10-04T11:06:16.434Z","updated_at":"2026-01-24T04:33:30.409Z","avatar_url":"https://github.com/aromalanil.png","language":"TypeScript","readme":"# 👷‍♂️ Worker Man \n\n[![NPM Version](https://img.shields.io/npm/v/worker-man)](https://www.npmjs.com/package/worker-man)\n![ESLint Check](https://github.com/aromalanil/worker-man/workflows/ESLint-Check/badge.svg)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/aromalanil/worker-man/blob/master/LICENSE)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/worker-man)](https://www.npmjs.com/package/worker-man)\n\n[![https://nodei.co/npm/worker-man.png?downloads=true\u0026downloadRank=true\u0026stars=true](https://nodei.co/npm/worker-man.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://www.npmjs.com/package/worker-man)\n\n`worker-man` is a lightweight and easy-to-use package for distributing CPU-intensive operations in Node.js.\n\nThis package let's you convert a CPU heavy functions into an async functions, which will run in a worker thread on invocation, it's that simple\n\n## Installation \n\n```bash\n# If you use npm:\nnpm install worker-man\n\n# Or if you use Yarn:\nyarn add worker-man\n```\n\n## Online Playground\nUse the button below to play with a small demo project to help familiarize with Worker Man.\n\n[![View on Codesandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/eloquent-gould-0szwss)\n\n## Usage\nHere's a basic example of how to use `worker-man`.\n\n1. Create a new file and define your CPU intensive function in it. \n2. Call `createWorker` with the `__filename` as first argument and the function you have defined as the second argument.\n\n\u003e fibonacci-worker.js\n```js\nimport { createWorker } from 'worker-man';\n\n // A CPU intensive fibonacci implementation\n export function cpuHeavyFindFibonacci(n){\n   if (n \u003c 2) return 1;\n   else return cpuHeavyFindFibonacci(n - 2) + cpuHeavyFindFibonacci(n - 1);\n }\n\n export const findFibonacci = createWorker(__filename, cpuHeavyFindFibonacci);\n```\n3. Save the return value of `createWorker`, which will be an `async` function that you can use anywhere in your codebase.\n\n\u003e main.js\n```js\nimport { findFibonacci } from './fibonacci-worker.ts'\nconst main = async () =\u003e {\n const fibonacci = await findFibonacci(200); // Here `findFibonacci` will be run in a worker thread\n console.log(fibonacci);\n}\n```\n\nIn the above example `findFibonacci` will be run in a worker thread\n\n## API\n### createWorker(filename, workerFunction)\nReturns a function that can be used to execute the workerFunction in a separate thread.\n\n### Arguments\n- filename (string): The absolute path of the file that creates the worker.\n- workerFunction (function): The function to be executed in the worker thread.\n### Return value\nA function that returns a Promise which resolves to the result of workerFunction.\n\n## Author\n[Aromal Anil](https://aromalanil.in)\n\n## License\nWorker Man is [MIT licensed](https://github.com/aromalanil/worker-man/blob/master/LICENSE).\n","funding_links":["https://github.com/sponsors/aromalanil","https://ko-fi.com/aromalanil","https://paypal.me/aromalanil","https://www.buymeacoffee.com/aromalanil"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faromalanil%2Fworker-man","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faromalanil%2Fworker-man","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faromalanil%2Fworker-man/lists"}