{"id":20850580,"url":"https://github.com/multiformats/js-dns","last_synced_at":"2025-06-21T18:09:31.678Z","repository":{"id":226626158,"uuid":"769221292","full_name":"multiformats/js-dns","owner":"multiformats","description":"Resolve DNS queries with browser fallback","archived":false,"fork":false,"pushed_at":"2025-04-28T16:00:58.000Z","size":96,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-05T20:04:31.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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,"zenodo":null}},"created_at":"2024-03-08T15:37:51.000Z","updated_at":"2025-04-28T16:01:00.000Z","dependencies_parsed_at":"2025-05-03T23:30:33.385Z","dependency_job_id":"d0d6ddd2-a415-462c-8147-124ff5fac692","html_url":"https://github.com/multiformats/js-dns","commit_stats":null,"previous_names":["multiformats/js-dns"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/multiformats/js-dns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiformats","download_url":"https://codeload.github.com/multiformats/js-dns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-dns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260221379,"owners_count":22976863,"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:18.788Z","updated_at":"2025-06-21T18:09:26.647Z","avatar_url":"https://github.com/multiformats.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @multiformats/dns\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-dns.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-dns)\n[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-dns/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/multiformats/js-dns/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e Resolve DNS queries with browser fallback\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\nQuery DNS records using `node:dns`, DNS over HTTP and/or DNSJSON over HTTP.\n\nA list of publicly accessible servers can be found [here](https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers).\n\n## Example - Using the default resolver\n\n```TypeScript\nimport { dns } from '@multiformats/dns'\n\nconst resolver = dns()\n\n// resolve A records with a 5s timeout\nconst result = await dns.query('google.com', {\n  signal: AbortSignal.timeout(5000)\n})\n```\n\n## Example - Using per-TLD resolvers\n\n```TypeScript\nimport { dns } from '@multiformats/dns'\nimport { dnsJsonOverHttps } from '@multiformats/dns/resolvers'\n\nconst resolver = dns({\n  resolvers: {\n    // will only be used to resolve `.com` addresses\n    'com.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query'),\n\n    // this can also be an array, resolvers will be shuffled and tried in\n    // series\n    'net.': [\n      dnsJsonOverHttps('https://dns.google/resolve'),\n      dnsJsonOverHttps('https://dns.pub/dns-query')\n    ],\n\n    // will only be used to resolve all other addresses\n    '.': dnsJsonOverHttps('https://dnsforge.de/dns-query'),\n  }\n})\n```\n\n## Example - Query for specific record types\n\n```TypeScript\nimport { dns, RecordType } from '@multiformats/dns'\n\nconst resolver = dns()\n\n// resolve only TXT records\nconst result = await dns.query('google.com', {\n  types: [\n    RecordType.TXT\n  ]\n})\n```\n\n## Caching\n\nIndividual Aanswers are cached so. If you make a request, for which all\nrecord types are cached, all values will be pulled from the cache.\n\nIf any of the record types are not cached, a new request will be resolved as\nif none of the records were cached, and the cache will be updated to include\nthe new results.\n\n## Example - Ignoring the cache\n\n```TypeScript\nimport { dns, RecordType } from '@multiformats/dns'\n\nconst resolver = dns()\n\n// do not used cached results, always resolve a new query\nconst result = await dns.query('google.com', {\n  cached: false\n})\n```\n\n# Install\n\n```console\n$ npm i @multiformats/dns\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make it's exports available as `MultiformatsDns` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@multiformats/dns/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://multiformats.github.io/js-dns\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-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiformats%2Fjs-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-dns/lists"}