{"id":20161020,"url":"https://github.com/delight-rpc/child-process","last_synced_at":"2026-05-06T09:38:42.372Z","repository":{"id":44816338,"uuid":"434669888","full_name":"delight-rpc/child-process","owner":"delight-rpc","description":"🌱","archived":false,"fork":false,"pushed_at":"2023-12-04T03:02:49.000Z","size":1103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T15:50:26.779Z","etag":null,"topics":["esm","library","nodejs","npm-package","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@delight-rpc/child-process","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/delight-rpc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2021-12-03T16:53:39.000Z","updated_at":"2023-03-19T08:55:03.000Z","dependencies_parsed_at":"2023-12-04T03:33:45.741Z","dependency_job_id":null,"html_url":"https://github.com/delight-rpc/child-process","commit_stats":{"total_commits":74,"total_committers":2,"mean_commits":37.0,"dds":0.1351351351351351,"last_synced_commit":"01b57b505169d914bb8a66dd8fe6ceb25cea1a8d"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delight-rpc%2Fchild-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delight-rpc%2Fchild-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delight-rpc%2Fchild-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delight-rpc%2Fchild-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delight-rpc","download_url":"https://codeload.github.com/delight-rpc/child-process/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241600482,"owners_count":19988713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["esm","library","nodejs","npm-package","typescript"],"created_at":"2024-11-14T00:16:56.491Z","updated_at":"2026-05-06T09:38:42.349Z","avatar_url":"https://github.com/delight-rpc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @delight-rpc/child-process\n## Install\n```sh\nnpm install --save @delight-rpc/child-process\n# or\nyarn add @delight-rpc/child-process\n```\n\n## Usage\n### Main as Client, ChildProcess as Server\n```ts\n// api.d.ts\ninterface IAPI {\n  echo(message: string): string\n}\n\n// child-process.ts\nimport { createServer } from '@delight-rpc/child-process'\n\nconst api: IAPI = {\n  echo(message: string): string {\n    return message\n  }\n}\n\ncreateServer(api, process)\n\n// main.ts\nimport { fork } from 'child_process'\nimport { createClient } from '@delight-rpc/child-process'\n\nconst childProcess = fork('./child-process.js', { serialization: 'advanced' })\nconst [client] = createClient\u003cIAPI\u003e(childProcess)\n\nawait client.echo('hello world')\n```\n\n### ChildProcess as Client, Main as Server\n```ts\n// api.d.ts\ninterface IAPI {\n  echo(message: string): string\n}\n\n// main.ts\nimport { fork } from 'child_process'\nimport { createServer } from '@delight-rpc/child-process'\n\nconst api: IAPI = {\n  echo(message: string): string {\n    return message\n  }\n}\n\nconst childProcess = fork('./child-process.js', { serialization: 'advanced' })\ncreateServer(api, childProcess)\n\n// child-process.ts\nimport { createClient } from '@delight-rpc/child-process'\n\nconst [client] = createClient\u003cIAPI\u003e(process)\nawait client.echo('hello world')\n```\n\n## API\n### createClient\n```ts\nfunction createClient\u003cIAPI extends object\u003e(\n  process: ChildProcess | NodeJS.Process\n, options?: {\n    parameterValidators?: DelightRPC.ParameterValidators\u003cIAPI\u003e\n    expectedVersion?: string\n    channel?: string\n    timeout?: number\n  }\n): [client: DelightRPC.ClientProxy\u003cIAPI\u003e, close: () =\u003e void]\n```\n\n### createBatchClient\n```ts\nfunction createBatchClient\u003cDataType\u003e(\n  process: ChildProcess | NodeJS.Process\n, options?: {\n    expectedVersion?: string\n    channel?: string\n    timeout?: number\n  }\n): [client: DelightRPC.BatchClient\u003cDataType\u003e, close: () =\u003e void]\n```\n\n### createServer\n```ts\nfunction createServer\u003cIAPI extends object\u003e(\n  api: DelightRPC.ImplementationOf\u003cIAPI\u003e\n, process: ChildProcess | NodeJS.Process\n, options?: {\n    parameterValidators?: DelightRPC.ParameterValidators\u003cIAPI\u003e\n    version?: `${number}.${number}.${number}`\n    channel?: string | RegExp | AnyChannel\n    ownPropsOnly?: boolean\n  }\n): () =\u003e void\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelight-rpc%2Fchild-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelight-rpc%2Fchild-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelight-rpc%2Fchild-process/lists"}