Mayank Agarwal has Published 373 Articles

Node.js – diffieHellman.setPrivateKey() Method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:22:03

124 Views

The diffieHellman.setPrivateKey() sets the Diffie-Hellman generated private key. The private key will be a string if an encoding argument is provided. If no encoding is provided, the private key will be of type buffer.SyntaxdiffieHellman.setPrivateKey( privateKey, [encoding] )Parametersencoding - This parameter specifies the encoding of the private Key.Example 1Create a file ... Read More

Node.js – Process Warning Event

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:15:45

363 Views

A 'warning' event is emitted whenever a Node.js event emits a process warning. The process warning is similar to an error that describes the exceptional conditions that are being brought to the user's attention.Node.js can emit warnings whenever it encounters any bad coding practices that could lead to poor performance ... Read More

Node.js – Timeout-ref() & Timeout-unref() method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:14:23

988 Views

The Timeout object is internally created and is returned from the setTimeout() and setInterval() methods. You can use this object and pass it to either clearTimeout() or clearInterval() if you want to cancel the scheduled actions.Following are the timeout class ref objects that can be used to control the default behaviour ... Read More

Node.js – Monitor mode in Redis

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:11:39

591 Views

Redis also supports the monitor command that lets the user to see all the commands received by the Redis server across all the client connections. These connections include commands from everywhere, including other client libraries and computers as well.The monitor event will monitor all the commands which are executed on the ... Read More

Node.js – stringDecoder.end() Method

Mayank Agarwal

Mayank Agarwal

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

139 Views

The stringDecoder.end() method will return any remaining input that is left in the internal buffer as a string. Bytes that are left incomplete and represent UTF-8 and UTF-16 characters are replaced with the substitution characters appropriate for character encoding.StringDecoder.write() method is called before returning the remaining input if any buffer ... Read More

Node.js – retry_strategy Property in Redis

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:07:08

3K+ Views

The retry_strategy is a function that receives objects as parameters including the retry attempt, total_retry_time that indicates the time passed after it was connected the last time, the error due to which the connection was lost, and the number of times_connected in total.If a number is returned from this function, ... Read More

Node.js – process.noDeprecation() Method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:01:55

152 Views

This process.noDeprecation() method states whether the --no- Deprecation flag is set or not on the current Node.js project. This Boolean flag controls whether the deprecation warning messages are printed to stderr or not. Setting this flag as True will silence all the deprecation warnings.Syntaxprocess.noDeprecation( )Example 1Create a file with the ... Read More

Node.js – dns.resolvePtr() Method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 07:00:48

115 Views

The dns.resolvePtr() method uses the DNS protocol to resolve the pointer records (PTR Records) for the hostname. The addresses argument passed to the callback function will contain the reply records as an array of strings.Syntaxdns.resolvePtr(hostname, callback)Parametershostname - This parameter takes the input for the hostname to be resolved.callback - This ... Read More

Node.js – dnsPromises.resolveSoa() Method

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 06:57:12

101 Views

The dnsPromises.resolveSoa() method uses the DNS protocol to resolve the Start of Authority records (SOA Records) for the hostname. On success, the promise is resolved with the following propertiesnsnamehostmasterserialrefreshretryexpireminttlSyntaxdnsPromises.resolveSoa( hostname )Parametershostname - This parameter takes the input for the hostname to be resolved.Example 1Create a file with the name "resolveSoa.js" and ... Read More

Node.js – client.end Method in Redis

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 06:52:42

2K+ Views

The client.end(flush) method forcibly closes all the connection to the Redis server without waiting until all the replies have been parsed. This method just closes all the connection and ongoing streaming between the Node and Redis server. If you want to exit cleanly, you should use client.quit() method.Syntaxclient.end(flush)Parametersflush - This ... Read More

Advertisements