- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 285 Articles for Node.js
88 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 name "noDeprecation.js" and copy the following code. After creating the file, use the command "node noDeprecation.js" to run this code as shown in the example below// process.noDeprecation() Demo Example // Importing the process module const process = require('process'); // Printing noDeprecation default value console.log(process.noDeprecation);Output 1undefined Output 2trueExample 2Let's ... Read More
58 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 function will catch errors, if any.records − Returns PTR records for the hostname.Example 1Create a file with the name "resolvePtr.js" and copy the following code. After creating the file, use the command "node resolvePtr.js" to run this code as shown in the example below// dns.resolvePtr() Demo Example // Importing ... Read More
48 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 copy the following code. After creating the file, use the command "node resolveSoa.js" to run this code as shown in the example below// dns.resolveSoa() Demo Example // Importing the dns module const dns = require('dns'); const dnsPromises = dns.promises; // Passing IP to find the hostname TXT ... Read More
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 input parameter will hold a Boolean value that will indicate whether to close a connection or not.Example 1Create a file with the name "clientEnd.js" and copy the following code. After creating the file, use the command "node clientEnd.js" to run this code as shown in the example below −// client.end() ... Read More
472 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 command basis.This property does not work with pub-sub mode.SyntaxdetectBuffers: trueExample 1Create a file with the name "detectBuffers.js" and copy the following code. After creating the file, use the command "node detectBuffers.js" to run this code, as shown in the example below:// detect_buffers Property Demo Example // Importing the redis ... Read More
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 colors and makes it easier to detect warnings and errors.Installationnpm install chalkExample 1Create a file with the name "chalk.js" and copy the following code. After creating the file, use the command "node chalk.js" to run this code as shown in the example below −// Importing the chalk module const chalk=require("chalk"); ... Read More
488 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 1Create a file with the name "beforeExit.js" and copy the following code. After creating the file, use the command "node beforeExit.js" to run this code as shown in the example below −// process 'beforeExit' Demo Example // Importing the process module const process = require('process'); // Calling the ... Read More
52 Views
The diffieHellman.getGenerator() method returns the Diffie-Hellman generator in the specified encoding. A string is returned in case an encoding is passed, else a buffer is returned.SyntaxdiffieHellman.getGenerator([encoding])Parametersencoding - This parameter specifies the encoding of the return value.Example 1Create a file with the name "generator.js" and copy the following code. After creating the file, use the command "node generator.js" to run this code as shown in the example below:// diffieHellman.getPrime() Demo Example // Importing cryptoDiffieHellman from the crypto module const { createDiffieHellman } = require('crypto'); // Initializing the diffieHellman object const dh = createDiffieHellman(512); // Generate DiffieHellman's Generator ... Read More
107 Views
The dnsPromises.resolveAny() method uses the DNS protocol to resolve all records (this is also known as ANY or * query). The promise is resolved with an array containing various types of records.TypeProperties'A'IPv4 address'AAAA'IPv6 address'Any'Any RecordsMXMail Exchange RecordsNAPTRName authority pointer recordsNSName server recordsPTRPointer RecordsSOAStart of Authority RecordsSRVService RecordsTXTText RecordsCNAMECanonical Name RecordsSyntaxdnsPromises.resolveAny(hostname)Parametershostname - This parameter takes input for the hostname to be resolved.Example 1Create a file with the name "resolveAny.js" and copy the following code. After creating the file, use the command "node resolveAny.js" to run this code, as shown in the example below −// Node.js program to demonstrate the // dnsPromises.resolveAny() method ... Read More
36 Views
This method indicates about the flag value of --throw-deprecation which is set to True or False on the current Node.js project.The process.throwDeprecation() method is mutable, so the deprecation warning results in errors may be altered at runtime.Syntaxprocess.throwDeprecation( )Example 1Create a file with the name "throwDeprecation.js" and copy the following code. After creating the file, use the command "node throwDeprecation.js" to run this code as shown in the example below// process.throwDeprecation() Demo Example // Importing the process module const process = require('process'); // Printing the --throw-Deprecation default value console.log(process.throwDeprecation);Output 1undefinedOutput 2trueExample 2Let's take another example// process.throwDeprecation() Demo Example ... Read More
To Continue Learning Please Login
Login with Google