{"id":14483680,"url":"https://github.com/ipfs/js-ipfsd-ctl","last_synced_at":"2025-04-14T01:02:11.489Z","repository":{"id":30997161,"uuid":"34555538","full_name":"ipfs/js-ipfsd-ctl","owner":"ipfs","description":"Control an IPFS daemon (go-ipfs or js-ipfs) using JavaScript!","archived":false,"fork":false,"pushed_at":"2025-03-28T13:44:57.000Z","size":3422,"stargazers_count":156,"open_issues_count":1,"forks_count":62,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-10T04:25:17.344Z","etag":null,"topics":["ctl","daemon","go-ipfs","ipfs","js-ipfs"],"latest_commit_sha":null,"homepage":"https://ipfs.github.io/js-ipfsd-ctl","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipfs.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":"2015-04-25T04:40:11.000Z","updated_at":"2025-04-06T06:29:27.000Z","dependencies_parsed_at":"2023-02-19T16:31:16.297Z","dependency_job_id":"76c6ab96-e25b-4463-ab93-f03b59b3979f","html_url":"https://github.com/ipfs/js-ipfsd-ctl","commit_stats":{"total_commits":631,"total_committers":48,"mean_commits":"13.145833333333334","dds":0.7274167987321711,"last_synced_commit":"e5177e79e85a9c848d785dd47347d1060d6ec582"},"previous_names":[],"tags_count":158,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfsd-ctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfsd-ctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfsd-ctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fjs-ipfsd-ctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs","download_url":"https://codeload.github.com/ipfs/js-ipfsd-ctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519973,"owners_count":21117841,"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":["ctl","daemon","go-ipfs","ipfs","js-ipfs"],"created_at":"2024-09-03T00:01:59.260Z","updated_at":"2025-04-14T01:02:11.448Z","avatar_url":"https://github.com/ipfs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ipfsd-ctl\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfsd-ctl.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfsd-ctl)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfsd-ctl/js-test-and-release.yml?branch=master\\\u0026style=flat-square)](https://github.com/ipfs/js-ipfsd-ctl/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n\u003e Spawn IPFS Daemons, Kubo or...\n\n# About\n\n\u003c!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n--\u003e\n\nThis module allows you to spawn long-lived IPFS implementations from any JS environment and interact with the as is they were in the local process.\n\nIt is designed mostly for testing interoperability and is not suitable for production use.\n\n## Spawning a single noder: `createNode`\n\n## Example - Spawning a Kubo node\n\n```TypeScript\nimport { createNode } from 'ipfsd-ctl'\nimport { path } from 'kubo'\nimport { create } from 'kubo-rpc-client'\n\nconst node = await createNode({\n  type: 'kubo',\n  rpc: create,\n  bin: path()\n})\n\nconsole.info(await node.api.id())\n```\n\n## Manage multiple nodes: `createFactory`\n\nUse a factory to spawn multiple nodes based on some common template.\n\n## Example - Spawning multiple Kubo nodes\n\n```TypeScript\nimport { createFactory } from 'ipfsd-ctl'\nimport { path } from 'kubo'\nimport { create } from 'kubo-rpc-client'\n\nconst factory = createFactory({\n  type: 'kubo',\n  rpc: create,\n  bin: path()\n})\n\nconst node1 = await factory.spawn()\nconst node2 = await factory.spawn()\n//...etc\n\n// later stop all nodes\nawait factory.clean()\n```\n\n## Override config based on implementation type\n\n`createFactory` takes a second argument that can be used to pass default options to an implementation based on the `type` field.\n\n```TypeScript\nimport { createFactory } from 'ipfsd-ctl'\nimport { path } from 'kubo'\nimport { create } from 'kubo-rpc-client'\n\nconst factory = createFactory({\n  type: 'kubo',\n  test: true\n}, {\n  otherImpl: {\n    //...other impl args\n  }\n})\n\nconst kuboNode = await factory.spawn()\nconst otherImplNode = await factory.spawn({\n  type: 'otherImpl'\n})\n```\n\n## Spawning nodes from browsers\n\nTo spawn nodes from browsers, first start an ipfsd-ctl server from node.js and make the address known to the browser (the default way is to set `process.env.IPFSD_CTL_SERVER` in your bundle):\n\n## Example - Create server\n\nIn node.js:\n\n```TypeScript\n// Start a remote disposable node, and get access to the api\n// print the node id, and stop the temporary daemon\n\nimport { createServer } from 'ipfsd-ctl'\n\nconst port = 9090\nconst server = createServer(port, {\n  type: 'kubo',\n  test: true\n}, {\n   // overrides\n})\nawait server.start()\n```\n\nIn a browser:\n\n```TypeScript\nimport { createFactory } from 'ipfsd-ctl'\n\nconst factory = createFactory({\n  // or you can set process.env.IPFSD_CTL_SERVER to http://localhost:9090\n  endpoint: `http://localhost:${port}`\n})\n\nconst node = await factory.createNode({\n  type: 'kubo'\n})\nconsole.info(await node.api.id())\n```\n\n## Disposable vs non Disposable nodes\n\n`ipfsd-ctl` can spawn `disposable` and `non-disposable` nodes.\n\n- `disposable`- Disposable nodes are useful for tests or other temporary use cases, they create a temporary repo which is deleted automatically when the node is stopped\n- `non-disposable` - Disposable nodes will not delete their repo when stopped\n\n# Install\n\n```console\n$ npm i ipfsd-ctl\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `IpfsdCtl` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/ipfsd-ctl/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://ipfs.github.io/js-ipfsd-ctl\u003e\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n# Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfsd-ctl/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fjs-ipfsd-ctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs%2Fjs-ipfsd-ctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fjs-ipfsd-ctl/lists"}