{"id":24228756,"url":"https://github.com/blacha/wtrpc","last_synced_at":"2026-01-19T07:01:57.536Z","repository":{"id":62472459,"uuid":"528731816","full_name":"blacha/wtrpc","owner":"blacha","description":"Typesafe worker threads","archived":false,"fork":false,"pushed_at":"2025-09-05T01:18:18.000Z","size":167,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-22T21:37:10.396Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blacha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-25T06:56:21.000Z","updated_at":"2025-09-05T01:18:08.000Z","dependencies_parsed_at":"2025-01-14T11:44:14.095Z","dependency_job_id":"ecccfd76-2a3f-4bfe-8a3f-fbd2545cc314","html_url":"https://github.com/blacha/wtrpc","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":0.4545454545454546,"last_synced_commit":"42b24b00b28d6765f212d990d0c1d2ffcf807be7"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/blacha/wtrpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fwtrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fwtrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fwtrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fwtrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blacha","download_url":"https://codeload.github.com/blacha/wtrpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fwtrpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-01-14T11:32:37.548Z","updated_at":"2026-01-19T07:01:57.519Z","avatar_url":"https://github.com/blacha.png","language":"TypeScript","readme":"# wtrpc\n\nType safe node js worker threads\n\nDefine a contract `contract.ts`\n```typescript\ntype RpcContract = {\n    scan: (req: {pid: number, pattern: string}) =\u003e number[]\n}\n```\n\nImplement the contract as a worker \n\n`worker.ts`\n```typescript\nimport { WorkerRpc } from '@wtrpc/core'\nimport { RpcContract } from './contract.js'\nimport { parentPort } from 'node:worker_threads';\n\nconst worker = new WorkerRpc\u003cRpcContract\u003e({\n    scan(req: {pid: number, pattern: string}): number[] {\n        return [-1]\n    }\n})\n\n// Bind the worker to the worker_thread parent port if it exists\nif (parentPort) worker.bind(parentPort);\n```\n\n`pool.ts`\n```typescript\nimport { WorkerRpcPool } from '@wtrpc/core'\nimport { RpcContract } from './contract.js'\n\nconst workerUrl = new URL('./worker.js', import.meta.url);\nconst threadCount = os.cpus().length;\n\nconst pool = new WorkerRpcPool\u003cRpcContract\u003e(threadCount, workerUrl);\n\n// Run the task on the worker thread pool\n\nconst tasks = [\n    { pid: 37 },\n    { pid: 50 },\n    { pid: 99 }\n]\n\nconst offsets = tasks.map(t =\u003e pool.run('scan', { pid: t.pid, pattern: '00 ?? 00 ?? 07' }));\nconst results = await Promise.all(offsets)\n// [-1]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fwtrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacha%2Fwtrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fwtrpc/lists"}