Mayank Agarwal has Published 380 Articles

Node.js – Monitor mode in Redis

Mayank Agarwal

Mayank Agarwal

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

431 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

108 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

99 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

68 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

60 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

1K+ 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

Node.js – detect_buffers Property in Redis

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 06:48:47

504 Views

Node.js Redis offers certain properties which can be used as per your usecase. One such property is detect_buffers.If this property is set to True, then the replies that are sent to the callbacks are sent as buffers.This option lets you switch between the buffer and strings based upon this single ... Read More

Node.js – Chalk Module

Mayank Agarwal

Mayank Agarwal

Updated on 24-Nov-2021 06:45:37

2K+ Views

The chalk module is a third-party library that can be used for styling of texts. It allows the users to create their own themes in a Node.js project.This module helps the users to customize the response messages with different colors as per the preferences.It also improves the readability by providing ... Read More

Node.js – Process beforeExit Event

Mayank Agarwal

Mayank Agarwal

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

529 Views

The 'beforeExit' event is called when Node.js empties its event loop and has no other work to schedule. The Node.js process exits normally when there is no work scheduled but a listener registered on the 'before exit' event can make async calls and thereby cause the Node.js process to continue.Example ... Read More

Advertisements