# chrome-dns

> Use the Node `dns` API in Chrome Apps

Latest version **1.0.1** (published 2019-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install chrome-dns
pnpm add chrome-dns
yarn add chrome-dns
bun add chrome-dns
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-08-10 |
| First published | 2019-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Feross Aboukhadijeh |
| Maintainers | feross |
| Keywords | chrome app, chrome.dns, chrome.dns.resolve, dns, domain name resolution, domain name server, dns lookup |

## Links

- npm: https://www.npmjs.com/package/chrome-dns
- Repository: https://github.com/feross/chrome-dns
- Issues: https://github.com/feross/chrome-dns/issues
- npm.io page: https://npm.io/package/chrome-dns

## Dependencies (1)

- [chrome-net](https://npm.io/package/chrome-net.md) ^3.3.2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-08-10
- 1.0.0 — 2019-08-10

## README

# chrome-dns [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/chrome-dns.svg
[npm-url]: https://npmjs.org/package/chrome-dns
[downloads-image]: https://img.shields.io/npm/dm/chrome-dns.svg
[downloads-url]: https://npmjs.org/package/chrome-dns
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

### Use the Node `dns` API in Chrome Apps

This module lets you use the Node.js [dns](https://nodejs.org/api/dns.html) API in [Chrome Packaged Apps](https://developer.chrome.com/apps/about_apps.html).

The chrome.dns API for Chrome Apps is not documented, but it still available. You need the "dns" permission in your manifest.

As of August 2019, it appears that the API is only available if you use Chrome Dev channel or Canary channel.

Instead of learning the quirks of Chrome's `chrome.dns` API for networking in Chrome Apps just **use the higher-level node API you're familiar with**. Then, compile your code with [browserify](https://github.com/substack/node-browserify) and you're all set!

This module is used by the Chrome App build of [webtorrent](https://github.com/feross/webtorrent), which is used in [Brave Browser](https://brave.com).

## install

```
npm install chrome-dns
```

## methods

Use node's `dns` API. Example:

```js
var dns = require('chrome-dns')

dns.lookup('feross.org', (err, address, family) => {
  if (err) {
    console.error(err)
    return
  }

  console.org(`feross.org has the IPv${family} address of ${address}`)
})
```

See nodejs.org for full API documentation: [dns](https://nodejs.org/api/dns.html)

## contribute

To run tests, use `npm test && npm run test-browser`. The tests will run TCP and
UDP servers and launch a few different Chrome Packaged Apps with browserified
client code. The tests currently require Chrome Canary.

## license

MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org)

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