title: Node.js dns.resolve() vs dns.lookup()
body: <p>I need to lookup a given host to its corresponding IP in Node.js. There seems to be two native methods of doing this:</p>
  
  <pre><code>&gt; dns.resolve('google.com', (error, addresses) =&gt; { console.error(error); console.log(addresses); });
  QueryReqWrap {
    bindingName: 'queryA',
    callback: { [Function: asyncCallback] immediately: true },
    hostname: 'google.com',
    oncomplete: [Function: onresolve],
    domain:
     Domain {
       domain: null,
       _events: { error: [Function] },
       _eventsCount: 1,
       _maxListeners: undefined,
       members: [] } }
  &gt; null
  [ '216.58.194.174' ]
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>&gt; dns.lookup('google.com', (error, address, family) =&gt; { console.error(error); console.log(address); console.log(family); });
  GetAddrInfoReqWrap {
    callback: { [Function: asyncCallback] immediately: true },
    family: 0,
    hostname: 'google.com',
    oncomplete: [Function: onlookup],
    domain:
     Domain {
       domain: null,
       _events: { error: [Function] },
       _eventsCount: 1,
       _maxListeners: undefined,
       members: [] } }
  &gt; null
  216.58.194.174
  4
  </code></pre>
  
  <p>Both return the same IPv4 address. What is the difference between <code>dns.lookup()</code> and <code>dns.resolve()</code>? Also, which is more performant for lots of requests per second?</p>