# @web4/dns

> DNS lookup for dat/bit archives

Latest version **1.0.0** (published 2022-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @web4/dns
pnpm add @web4/dns
yarn add @web4/dns
bun add @web4/dns
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-03-15 |
| First published | 2022-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 116 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Heidegger |
| Maintainers | neothawreww |
| Keywords | dat, dns, hyper |

## Links

- npm: https://www.npmjs.com/package/@web4/dns
- Repository: https://github.com/bitwebs/dns
- Homepage: https://github.com/bitwebs/dns#readme
- Issues: https://github.com/bitwebs/dns/issues
- npm.io page: https://npm.io/package/@web4/dns

## Dependencies (8)

- [debug](https://npm.io/package/debug.md) ^4.3.1
- [env-paths](https://npm.io/package/env-paths.md) ^2.2.1
- [quick-lru](https://npm.io/package/quick-lru.md) ^4.0.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [better-sqlite3](https://npm.io/package/better-sqlite3.md) ^7.1.4
- [proxy-from-env](https://npm.io/package/proxy-from-env.md) ^1.1.0
- [@consento/promise](https://npm.io/package/@consento/promise.md) ^1.0.7
- [https-proxy-agent](https://npm.io/package/https-proxy-agent.md) ^5.0.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-03-15

## README

# @web4/dns

Advanced resolving of decentralized web links using different name systems such as DNS Txt entries and `.well-known` https lookups locations.
It implements various naming systems such as [dat][], [bit][] and [cabal][] but is extensible to support other systems as well.

[bit]: https://bitwebs.org
[dat]: https://www.datprotocol.com/deps/0005-dns/
[cabal]: https://cabal.chat/
[ara]: https://ara.one/

## 🚀 Basic API

After installing it through [npm][@web4], you can simply run it like this:

```js
const { resolveProtocol, resolve, resolveURL } = require('@web4/dns')
const protocol = 'bit'
const domain = 'social.x'
const key = await resolveProtocol(protocol, domain)
```

> Note: You may need to wrap it in a `async` function until [top level async/await][] lands.

That's it! 🎉 - in the `key` variable you will get the `bit` key or `null`, if it can't be found.

[hyper-dns-npm]: https://npmjs.com/package/@web4/dns
[top level async/await]: https://github.com/tc39/proposal-top-level-await

## 🧙‍♀️ What is this magic?

Different decentralized web systems have different means to resolve _"names"_ to a decentralized document.

`@web4/dns` contains a variety of implementations. Many are using [DNS TXT records][] that contain a key of specified pattern, but other means are possible as well. − (more in the [Protocol Guide][])

The power of `@web4/dns` in comparison to other, protocol-specific implementations is that it has a shared cache for all protocols, it works in he browser and does a list of things well. − (more in the [Architecture Overview][])

[DNS TXT records]: https://en.wikipedia.org/wiki/TXT_record

## 👩‍🎓 Further reading

- [Architecture Overview][] _…to learn how caching and other things work._ 🕵️‍♀️
- [API documentation][] _…for getting to know the API in detail._ 🧑‍💻
- [Contribution Guide][] _…because help is always welcome._ 🥳
- [Protocol Guide][] _…for current protocols and adding new ones._ 🤠

[Architecture Overview]: ./docs/architecture.md
[API documentation]: ./docs/api.md
[Contribution Guide]: ./docs/contributing.md
[Protocol Guide]: ./docs/protocol.md

## 📜 License

[MIT License](./LICENSE)

---
_Source: https://npm.io/package/@web4/dns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
