{"id":18584458,"url":"https://github.com/ipfs-examples/helia-typescript","last_synced_at":"2026-02-22T23:33:45.932Z","repository":{"id":186931953,"uuid":"676001790","full_name":"ipfs-examples/helia-typescript","owner":"ipfs-examples","description":"Building Helia with TypeScript","archived":false,"fork":false,"pushed_at":"2025-05-01T08:39:13.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T11:35:17.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ipfs-examples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2023-08-08T07:59:15.000Z","updated_at":"2025-05-01T07:36:34.000Z","dependencies_parsed_at":"2024-01-19T16:42:24.238Z","dependency_job_id":"ff2cf487-d57f-40ce-a46a-e6c7257c0267","html_url":"https://github.com/ipfs-examples/helia-typescript","commit_stats":null,"previous_names":["ipfs-examples/helia-typescript"],"tags_count":0,"template":false,"template_full_name":"ipfs-examples/example-fork-go-template","purl":"pkg:github/ipfs-examples/helia-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Fhelia-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Fhelia-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Fhelia-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Fhelia-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs-examples","download_url":"https://codeload.github.com/ipfs-examples/helia-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs-examples%2Fhelia-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29730748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: 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":"2024-11-07T00:27:34.886Z","updated_at":"2026-02-22T23:33:45.910Z","avatar_url":"https://github.com/ipfs-examples.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/ipfs/helia\" title=\"Helia\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png\" alt=\"Helia logo\" width=\"300\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\u003cb\u003eBuilding Helia with TypeScript\u003c/b\u003e\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/jlord/forkngo/gh-pages/badges/cobalt.png\" width=\"200\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://ipfs.github.io/helia/modules/helia.html\"\u003eExplore the docs\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/ipfs-examples/helia-examples/issues\"\u003eReport Bug\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/ipfs-examples/helia-examples/issues\"\u003eRequest Feature/Example\u003c/a\u003e\n\u003c/p\u003e\n\n## About\n\n[ECMAScript Modules](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/) are how JavaScript applications organise code into multiple files and import those files into other parts of the application. They became part of the language in [2015](https://262.ecma-international.org/6.0/) and are now supported on all platforms.\n\nPrior to this the de facto standard for JavaScript modules was [CommonJS](https://en.wikipedia.org/wiki/CommonJS) though this scheme was never adopted as a standard so remains a userland attempt to solve the problems of code modularisation.\n\nAs part of the standard, an `import` of an ES module returns a Promise whereas a `require` of a CJS module returns the module itself so unfortunately these two schemes are incompatible with each other. Most transpilation engines allow the use of `import` with CJS, however the reverse is not true.\n\nThe normal way to load one TypeScript module from another is to use the ESM-looking `import` statement, however by default it will output CJS code:\n\n**Config**\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2015\",\n\n    \"moduleResolution\": \"node\",\n    \"skipLibCheck\": true,\n    \"outDir\": \"./dist\"\n  }\n}\n```\n\n**Source code**\n\n```ts\nimport { createHelia } from 'helia'\n\ncreateHelia()\n  .then(() =\u003e {\n    console.info('Helia is running')\n    console.info('PeerId:', helia.libp2p.peerId.toString())\n  })\n```\n\n**Compiled code**\n\n```js\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst helia_1 = require(\"helia\");\n(0, helia_1.createHelia)().then(() =\u003e {\n    console.info('Helia is running');\n    console.info('PeerId:', helia.libp2p.peerId.toString());\n});\n```\n\nHelia is bundled using ESM and not CJS so this will fail at runtime:\n\n```console\n% node dist/index.js\nnode:internal/modules/cjs/loader:544\n      throw e;\n      ^\n\nError [ERR_PACKAGE_PATH_NOT_EXPORTED]: No \"exports\" main defined in /path/to/project/node_modules/helia/package.json\n    at new NodeError (node:internal/errors:399:5)\n    at exportsNotFound (node:internal/modules/esm/resolve:361:10)\n    at packageExportsResolve (node:internal/modules/esm/resolve:641:13)\n    at resolveExports (node:internal/modules/cjs/loader:538:36)\n    at Module._findPath (node:internal/modules/cjs/loader:607:31)\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1033:27)\n    at Module._load (node:internal/modules/cjs/loader:893:27)\n    at Module.require (node:internal/modules/cjs/loader:1113:19)\n    at require (node:internal/modules/cjs/helpers:103:18)\n    at Object.\u003canonymous\u003e (/path/to/project/index.js:4:17) {\n  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'\n}\n```\n\nTo fix this error, `\"module\"` and `\"target\"` must be set to at least `\"ES2015\"`.\n\nThese are the very minimum versions that will build ESM and not CJS - your application may require something more recent depending on which JavaScript features you are using.\n\nIf in doubt, look at the compiled code your application generates.  If you see use of the `require` function, you are building CJS and need to change your `\"module\"` setting.\n\n**Config**\n\n```json\n{\n  \"compilerOptions\": {\n    \"module\": \"ES2015\",\n    \"target\": \"ES2015\",\n\n    \"moduleResolution\": \"node\",\n    \"skipLibCheck\": true,\n    \"outDir\": \"./dist\"\n  }\n}\n```\n\n**Source code**\n\n```ts\nimport { createHelia } from 'helia'\n\ncreateHelia()\n  .then(() =\u003e {\n    console.info('Helia is running')\n  })\n```\n\n**Compiled code**\n\n```js\nimport { createHelia } from 'helia';\ncreateHelia()\n    .then(helia =\u003e {\n    console.info('Helia is running');\n    console.info('PeerId:', helia.libp2p.peerId.toString());\n});\n```\n\n**Output**\n\n```console\n% node dist/index.js\nHelia is running\nPeerId: 12D3KooWNj6PKy8boHWnDi39NTEJKomw4u6gW9umfpfRNzJPCv7e\n```\n\n## Usage\n\nYou can use [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to build the project and then node to run it with:\n\n```console\n% npm start\n```\n\n## About The Project\n\n- Read the [docs](https://ipfs.github.io/helia/modules/helia.html)\n- Look into other [examples](https://github.com/ipfs-examples/helia-examples) to learn how to spawn a Helia node in Node.js and in the Browser\n- Visit https://dweb-primer.ipfs.io to learn about IPFS and the concepts that underpin it\n- Head over to https://proto.school to take interactive tutorials that cover core IPFS APIs\n- Check out https://docs.ipfs.io for tips, how-tos and more\n- See https://blog.ipfs.io for news and more\n- Need help? Please ask 'How do I?' questions on https://discuss.ipfs.io\n\n## Documentation\n\n- [IPFS Primer](https://dweb-primer.ipfs.io/)\n- [IPFS Docs](https://docs.ipfs.io/)\n- [Tutorials](https://proto.school)\n- [More examples](https://github.com/ipfs-examples/helia-examples)\n- [API - Helia](https://ipfs.github.io/helia/modules/helia.html)\n- [API - @helia/unixfs](https://ipfs.github.io/helia-unixfs/modules/helia.html)\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the IPFS Project\n2. Create your Feature Branch (`git checkout -b feature/amazing-feature`)\n3. Commit your Changes (`git commit -a -m 'feat: add some amazing feature'`)\n4. Push to the Branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Want to hack on IPFS?\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\nThe IPFS implementation in JavaScript needs your help! There are a few things you can do right now to help out:\n\nRead the [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md) and [JavaScript Contributing Guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md).\n\n- **Check out existing issues** The [issue list](https://github.com/ipfs/helia/issues) has many that are marked as ['help wanted'](https://github.com/ipfs/helia/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22) or ['difficulty:easy'](https://github.com/ipfs/helia/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Adifficulty%3Aeasy) which make great starting points for development, many of which can be tackled with no prior IPFS knowledge\n- **Look at the [Helia Roadmap](https://github.com/ipfs/helia/blob/main/ROADMAP.md)** This are the high priority items being worked on right now\n- **Perform code reviews** More eyes will help\n  a. speed the project along\n  b. ensure quality, and\n  c. reduce possible future bugs\n- **Add tests**. There can never be enough tests\n\n[cid]: https://docs.ipfs.tech/concepts/content-addressing  \"Content Identifier\"\n[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n[libp2p]: https://libp2p.io\n[IndexedDB]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\n[S3]: https://aws.amazon.com/s3/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-examples%2Fhelia-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs-examples%2Fhelia-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs-examples%2Fhelia-typescript/lists"}