Skip to content
Use the Node `dns` API in Chrome Apps
JavaScript HTML
Branch: master
Clone or download
Latest commit e251b7d Aug 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.npmignore initial commit Aug 10, 2019
.travis.yml initial commit Aug 10, 2019
LICENSE initial commit Aug 10, 2019
README.md Update README.md Aug 10, 2019
index.js initial commit Aug 10, 2019
package.json 1.0.1 Aug 10, 2019

README.md

chrome-dns travis 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

You can’t perform that action at this time.