{"id":20850583,"url":"https://github.com/multiformats/js-uri-to-multiaddr","last_synced_at":"2025-05-12T04:31:37.143Z","repository":{"id":42229117,"uuid":"151240585","full_name":"multiformats/js-uri-to-multiaddr","owner":"multiformats","description":"Convert a URI to a Multiaddr: https://protocol.ai -\u003e /dns4/protocol.ai/tcp/443/https","archived":false,"fork":false,"pushed_at":"2024-08-12T10:39:52.000Z","size":380,"stargazers_count":3,"open_issues_count":4,"forks_count":4,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-10-29T01:21:34.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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":"2018-10-02T11:00:25.000Z","updated_at":"2023-01-11T12:56:37.000Z","dependencies_parsed_at":"2024-06-18T21:21:26.029Z","dependency_job_id":"8e50389f-99c2-4779-98eb-ae839dd21080","html_url":"https://github.com/multiformats/js-uri-to-multiaddr","commit_stats":{"total_commits":36,"total_committers":7,"mean_commits":5.142857142857143,"dds":0.6666666666666667,"last_synced_commit":"e102fbafeb52c788b9d01d6198e9ee8449a69bbe"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-uri-to-multiaddr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-uri-to-multiaddr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-uri-to-multiaddr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-uri-to-multiaddr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiformats","download_url":"https://codeload.github.com/multiformats/js-uri-to-multiaddr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225120015,"owners_count":17423818,"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:22.179Z","updated_at":"2024-11-18T03:10:22.730Z","avatar_url":"https://github.com/multiformats.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @multiformats/uri-to-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-uri-to-multiaddr.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-uri-to-multiaddr)\n[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-uri-to-multiaddr/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/multiformats/js-uri-to-multiaddr/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e Convert a URI to a Multiaddr\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\n```typescript\nimport { uriToMultiaddr } from '@multiformats/uri-to-multiaddr'\n\nconsole.log(uriToMultiaddr('https://protocol.ai'))\n// -\u003e /dns4/protocol.ai/tcp/443/https\n```\n\nDomain names can represent one of\n\n- `/dns4` - domain resolves to an ipv4 address (**default**)\n- `/dns6` - domain resolves to an ipv6 address\n- `/dnsaddr` - domain has a [DNSLink](https://docs.ipfs.io/guides/concepts/dnslink/) TXT record pointing to an IPFS CID\n\nThis library assumes `/dns4` when it finds a domain name in the input string.\nIt makes no attempt query DNS. To override the default assumption, you can pass\nin an options object as the second parameter to override it:\n\n```typescript\nimport { uriToMultiaddr } from '@multiformats/uri-to-multiaddr'\n\nconsole.log(uriToMultiaddr('https://protocol.ai'), { defaultDnsType: 'dns6' })\n// -\u003e /dns6/protocol.ai/tcp/443/https\n```\n\nSee [test.js](./test.js) for the currently supported conversions.\n\n**Note**: `uri-to-multiaddr` will throw if the passed URI:\n\n- is not a valid, according the WHATWG URL spec implementation used.\n- is not supported yet\n\n## Related\n\n- [@multiformats/multiaddr-to-uri](https://github.com/multiformats/js-multiaddr-to-uri) - convert it back again\n\n# Install\n\n```console\n$ npm i @multiformats/uri-to-multiaddr\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `MultiformatsUriToMultiaddr` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@multiformats/uri-to-multiaddr/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://multiformats.github.io/js-uri-to-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-uri-to-multiaddr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiformats%2Fjs-uri-to-multiaddr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-uri-to-multiaddr/lists"}