{"id":21359601,"url":"https://github.com/suin/runspace","last_synced_at":"2025-07-23T06:35:46.460Z","repository":{"id":57163462,"uuid":"301428645","full_name":"suin/runspace","owner":"suin","description":"Isolated execution context for Node.js.","archived":false,"fork":false,"pushed_at":"2020-10-09T07:27:41.000Z","size":345,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T00:53:28.942Z","etag":null,"topics":["isolation","sandbox"],"latest_commit_sha":null,"homepage":"https://suin.github.io/runspace/","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/suin.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}},"created_at":"2020-10-05T14:04:52.000Z","updated_at":"2020-10-09T07:27:20.000Z","dependencies_parsed_at":"2022-08-31T22:23:06.255Z","dependency_job_id":null,"html_url":"https://github.com/suin/runspace","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/suin/runspace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Frunspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Frunspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Frunspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Frunspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suin","download_url":"https://codeload.github.com/suin/runspace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suin%2Frunspace/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266631586,"owners_count":23959420,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["isolation","sandbox"],"created_at":"2024-11-22T05:29:00.934Z","updated_at":"2025-07-23T06:35:46.437Z","avatar_url":"https://github.com/suin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @suin/runspace\n\nIsolated execution context for Node.js.\n\n## Installation\n\n```shell script\n# via NPM\nnpm install --save @suin/runspace\n# via Yarn\nyarn add @suin/runspace\n```\n\n## Usage\n\nBasic usage:\n\n```javascript\n// main.js\nconst { ThreadSpace, ChildProcessSpace } = require(\"@suin/runspace\");\n\n(async () =\u003e {\n  const space = new ThreadSpace({ filename: \"./target.js\" }) // Or new ChildProcessSpace({ filename: \"./target.js\" })\n    .on(\"message\", (message) =\u003e console.log(message))\n    .on(\"error\", (error) =\u003e console.error(error))\n    .on(\"rejection\", (reason) =\u003e console.error(reason));\n\n  await space.waitStart();\n  space.send(\"Hello\");\n  await space.waitStop();\n})();\n\n// target.js\nprocess.on(\"message\", (message) =\u003e {\n  process.send(message + \" World\");\n  process.exit();\n});\n\n// Output:\n// \"Hello World\"\n```\n\nWaits a message from the program inside the space:\n\n```javascript\n// target.js\nconst http = require(\"http\");\n\nconst server = http.createServer((req, res) =\u003e {\n  res.write(\"OK\");\n  res.end();\n});\nserver.listen(8000, () =\u003e {\n  process.send(\"HTTP_SERVER_READY\");\n});\n\n// main.js\nconst { ThreadSpace } = require(\"@suin/runspace\");\nconst fetch = require(\"node-fetch\");\n\n(async () =\u003e {\n  const space = new ThreadSpace({ filename: \"./target.js\" });\n  await space.waitStart();\n  await space.waitMessage((message) =\u003e message === \"HTTP_SERVER_READY\");\n  const res = await fetch(\"http://localhost:8000\");\n  const text = await res.text();\n  await space.stop();\n  console.log(text); // Output: \"OK\"\n})();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuin%2Frunspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuin%2Frunspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuin%2Frunspace/lists"}