chrome-dns

1.0.1 • Public • Published

chrome-dns npm downloads javascript style guide

Use the Node dns API in Chrome Apps

This module lets you use the Node.js dns API in Chrome Packaged Apps.

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 and you're all set!

This module is used by the Chrome App build of webtorrent, which is used in Brave Browser.

install

npm install chrome-dns

methods

Use node's dns API. Example:

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

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

Package Sidebar

Install

npm i chrome-dns

Weekly Downloads

3,384

Version

1.0.1

License

MIT

Unpacked Size

5.64 kB

Total Files

4

Last publish

Collaborators

  • feross