{"id":20850617,"url":"https://github.com/multiformats/js-multiaddr","last_synced_at":"2025-05-15T04:06:02.592Z","repository":{"id":39542372,"uuid":"20607633","full_name":"multiformats/js-multiaddr","owner":"multiformats","description":"JavaScript implementation of multiaddr","archived":false,"fork":false,"pushed_at":"2025-05-07T10:33:23.000Z","size":3344,"stargazers_count":108,"open_issues_count":6,"forks_count":67,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-08T04:04:50.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://multiformats.github.io/js-multiaddr","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/multiformats.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":"2014-06-08T02:37:08.000Z","updated_at":"2025-03-28T13:06:28.000Z","dependencies_parsed_at":"2024-03-21T15:59:32.712Z","dependency_job_id":"a83e69b8-881e-4d0d-a84a-adcac671fff8","html_url":"https://github.com/multiformats/js-multiaddr","commit_stats":{"total_commits":453,"total_committers":50,"mean_commits":9.06,"dds":0.7637969094922737,"last_synced_commit":"a379624687a61cf1328ab3566c24f3f02a75c30e"},"previous_names":[],"tags_count":134,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiformats","download_url":"https://codeload.github.com/multiformats/js-multiaddr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253613759,"owners_count":21936333,"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":[],"created_at":"2024-11-18T03:10:36.209Z","updated_at":"2025-05-15T04:05:57.581Z","avatar_url":"https://github.com/multiformats.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @multiformats/multiaddr\n\n[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)\n[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiaddr.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiaddr)\n[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/multiformats/js-multiaddr/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e multiaddr implementation (binary + string representation of network addresses)\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\nA standard way to represent addresses that\n\n- support any standard network protocol\n- are self-describing\n- have a binary packed format\n- have a nice string representation\n- encapsulate well\n\n## Example\n\n```TypeScript\nimport { multiaddr } from '@multiformats/multiaddr'\n\nconst addr = multiaddr('/ip4/127.0.0.1/udp/1234')\n// Multiaddr(/ip4/127.0.0.1/udp/1234)\n\naddr.bytes\n// \u003cUint8Array 04 7f 00 00 01 11 04 d2\u003e\n\naddr.toString()\n// '/ip4/127.0.0.1/udp/1234'\n\naddr.protos()\n// [\n//   {code: 4, name: 'ip4', size: 32},\n//   {code: 273, name: 'udp', size: 16}\n// ]\n\n// gives you an object that is friendly with what Node.js core modules expect for addresses\naddr.nodeAddress()\n// {\n//   family: 4,\n//   port: 1234,\n//   address: \"127.0.0.1\"\n// }\n\naddr.encapsulate('/sctp/5678')\n// Multiaddr(/ip4/127.0.0.1/udp/1234/sctp/5678)\n```\n\n## Resolving DNSADDR addresses\n\n[DNSADDR](https://github.com/multiformats/multiaddr/blob/master/protocols/DNSADDR.md) is a spec that allows storing a TXT DNS record that contains a Multiaddr.\n\nTo resolve DNSADDR addresses, call the `.resolve()` function the multiaddr, optionally passing a `DNS` resolver.\n\nDNSADDR addresses can resolve to multiple multiaddrs, since there is no limit to the number of TXT records that can be stored.\n\n## Example - Resolving DNSADDR Multiaddrs\n\n```TypeScript\nimport { multiaddr, resolvers } from '@multiformats/multiaddr'\nimport { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'\n\nresolvers.set('dnsaddr', dnsaddrResolver)\n\nconst ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\n\n// resolve with a 5s timeout\nconst resolved = await ma.resolve({\n  signal: AbortSignal.timeout(5000)\n})\n\nconsole.info(resolved)\n// [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n```\n\n## Example - Using a custom DNS resolver to resolve DNSADDR Multiaddrs\n\nSee the docs for [@multiformats/dns](https://www.npmjs.com/package/@multiformats/dns) for a full breakdown of how to specify multiple resolvers or resolvers that can be used for specific TLDs.\n\n```TypeScript\nimport { multiaddr } from '@multiformats/multiaddr'\nimport { dns } from '@multiformats/dns'\nimport { dnsJsonOverHttps } from '@multiformats/dns/resolvers'\n\nconst resolver = dns({\n  resolvers: {\n    '.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query')\n  }\n})\n\nconst ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\nconst resolved = await ma.resolve({\n dns: resolver\n})\n\nconsole.info(resolved)\n// [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n```\n\n# Install\n\n```console\n$ npm i @multiformats/multiaddr\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `MultiformatsMultiaddr` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@multiformats/multiaddr/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://multiformats.github.io/js-multiaddr\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# Contribution\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-multiaddr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiformats%2Fjs-multiaddr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-multiaddr/lists"}