Mayank Agarwal has Published 373 Articles

Node.js - dns.reverse() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:53:57

2K+ Views

The dns.reverse() method is somewhat opposite of the method dns.lookup().This method performs a reverse DNS query that resolves an IPv4 or IPv6 to an array of host names.Syntaxdns.reverse(ip, callback)Parametersip – This takes an input for ip as a string, for which the DNS needs to be found.callback – It will ... Read More

Node.js - clent.hgetall & client.hmset in Redis

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:47:52

3K+ Views

Redis commands mostly take the input as a single string or an array of strings as arguments and the replies are sent back as a single string or an array of strings. But, while dealing with the hash values, there are a couple of exceptions.The client.hgetall() function in Node.js – ... Read More

How to exit a process in Node.js?

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:42:16

10K+ Views

There are some cases where we need to exit a certain process in Node.js based upon a condition. For this condition, we have the following methods where we can escape or exit any Node.js Process.Method 1: Using the Ctrl+C keyI hope everyone knows this shortcut to exit any Node.js process ... Read More

Node.js – dnsPromises.reverse() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:35:55

189 Views

The dnsPromises.reverse() method performs a reverse DNS search to resolve the IPv4 or Ipv6 address to an array of hostnames. The promise is rejected with an Error object if a Success status is not encountered.SyntaxdnsPromises.reverse( ip )where, ip is the parameter that takes the input for the IP address to ... Read More

Node.js – dns.resolveSoa() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:30:06

96 Views

The dns.resolveSoa() method uses the DNS protocol to resolve the start of authority records for the hostname. The address argument passed to the callback function will be an object that will contain the following properties −nsnamehostmasterserialrefreshentryexpireSyntaxdns.resolveSoa(hostname, callback)ParametersIt accepts the following parameters −hostname – This parameter takes the input for the ... Read More

How to download a file using Node.js?

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 11:23:34

11K+ Views

We can download file using Node.js by either using third-party libraries or using some inbuilt packages.Method 1: Using 'https' and 'fs' moduleWe can use the http GET method to fetch the files that are to be downloaded.The createWriteStream() method from fs module creates a writable stream and receives the argument ... Read More

Node.js - diffieHellman.computeSecret() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 10:45:35

239 Views

The diffieHellman.computeSecret() is used for computing the shared secret using the public key of other's party and returning the computed shared secret. The suppliedKey is interpreted using the specified inputEncoding and the secret is encoded using the specified outputEncoding. If the inputEncoding is not specified the other publicKey is expected ... Read More

Node.js – Timers Module – Cancelling Timers

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:36:33

456 Views

A timer can only be cancelled after it is being scheduled. The Immediate class has an object for setImmediate() method and passes the same object to clearImmediate(), in case it wants to cancel the scheduled timer function.Scheduling TimersThis type of timers schedules the task to take place after a certain ... Read More

Using Redis Cache with Spring Boot

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:34:57

6K+ Views

In this article, we will see how to integrate Redis Cache with Spring Boot. We will learn how we can configure Redis data inside the Spring boot cache.Let's look at the dependencies first that are required to import Redis into a Spring boot application.Dependencies// Adding spring-boot cache & redis dependencies ... Read More

Node.js – dns.lookupService() Method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:25:17

215 Views

The dns.lookupService() method resolves a given address and port into a hostname and service. This method uses the operating system's underlying getnameinfo implementation. A TypeError will be thrown if the address is not a valid IP address.Syntaxdns.lookupService(address, port, callback)Parametersaddress - This parameter takes input for the IP address that needs ... Read More

Advertisements