VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-dnspromises-resolvens-method/

⇱ Node.js dnsPromises.resolveNs() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js dnsPromises.resolveNs() Method

Last Updated : 13 Oct, 2021
The dnsPromises.resolveNs() method is an inbuilt application programming interface of the Promises object of dns module which is used to resolve NS or name server records for the specified hostname using DNS protocol. Syntax:
dnsPromises.resolveNs( hostname )
Parameters: This method has one parameter as mentioned above and described below:
  • hostname: this parameter specifies a string which denotes the hostname to be resolved.
Return Value: This method returns error, addresses. Below examples illustrate the use of dnsPromises.resolveNs() method in Node.js: Example 1: Output:
for google :
[ 'ns2.google.com',
 'ns3.google.com',
 'ns4.google.com',
 'ns1.google.com'
]
Example 2: Output:
from async:
[ 'ns-1520.awsdns-62.org',
 'ns-869.awsdns-44.net',
 'ns-245.awsdns-30.com',
 'ns-1569.awsdns-04.co.uk'
]
Note: The above program will compile and run by using the node index.js command. Reference: https://nodejs.org/api/dns.html#dns_dnspromises_resolvens_hostname
Comment

Explore