
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 266 Articles for Node.js

3K+ Views
"Process out of Memory" is an error that occurs when a Node.js program tries to use more memory than the system has available. This can happen when the program grows too big or runs for too long and can cause the system to stop working properly. To prevent this error, we may need to limit the amount of memory our program uses or find ways to optimize its performance. In this tutorial, we will learn about the "Process out of Memory Exception" in Node.js, what causes it to occur, and how to solve it. We will also explore some ... Read More

6K+ Views
In this article, you will understand how to calculate local time in Node.js. The Date object works with dates and times. Date objects are created with new Date(). JavaScript will use the browser's time zone and display a date as a full text string. Node.js is an open-source and cross-platform JavaScript runtime environment.As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. Example 1 In this example, we use the toDateString and toTimeString function const dateTimeObject = new Date(); console.log("A date-time object is created") console.log(`Date: ${dateTimeObject.toDateString()}`); console.log(`Time: ${dateTimeObject.toTimeString()}`); Output A date-time object is created ... Read More

916 Views
Introduction Bugs are bugging mankind since ancient times. At that time they produced different diseases but today’s bugs are logical errors in the program. Sometimes these are also a nightmare for developers. Here in this article, we will learn to create a Node.js app on a Docker container and also how to attach a debugger to the node application. What is debugging? Debugging is nothing but resolving the issues or errors in the code of the Node.js application. This application might be going through a rough time implementing all the tasks given to it. Debugging helps in smoothing all ... Read More

2K+ Views
The Passport is a node package, or library which we can install in any nodeJs project. The Passport provides the functionality for authentication in the app. Also, it provides different encryption strategies to encrypt user information, such as a password. For example, what if Facebook or Google employees could see the password of their users? It is against user privacy. So, in such cases, we can use the Passport, which encrypts the password and stores it in the database. We should know the decryption algorithm and secret key to decrypt the password. Also, the Passport allows us to establish the ... Read More

1K+ Views
The 'shortId' package from NPM can be used to create short non-sequential URL-friendly unique ID's. By default, it returns a 7-14 URL-friendly characters from the following categories: "A-Z, a-z, 0-9, _, -". This package also supports clusters (automatically), custom seeds, and custom alphabets. It can generate any number of ID's without duplication.SyntaxSetting up the NPM project:npm init -yInstalling the 'shortId' dependency:npm install express shortidImporting shortId:const short = require('shortid');Example 1Create a file with the name "shortId.js" and copy the following code snippet. After creating the file, use the command "node shortId.js" to run this code as shown in the example below ... Read More

648 Views
When a Node.js process is spawned with an IPC channel, the process.disconnect() method will close that IPC channel to the parent process, allowing the child process to exit or finish gracefully. The process will exit once there are no other connections keeping it alive.Syntaxprocess.disconnect()Example 1Create two files with the names "parent.js" and "child.js" and copy the following code snippets. After creating the file, use the command "node parent.js" to run parent.js.parent.js// process.channel Property Demo Example // Importing the child_process modules const fork = require('child_process').fork; // Attaching the child process file const child_file = 'child.js'; // Spawning/calling child ... Read More

106 Views
The dnsPromises.resolve6() method uses the DNS protocol to resolve the IPv6 addresses (AAAA records) for the hostname. The promise is resolved with an array of IPv6 addresses.Syntaxdns.resolve6(hostname, [options])Parametershostname – This parameter takes input for hostname to be resolved.options – It can have the following options −ttl – It defines the Time-To-Live (TTL) for each record.Example 1Create a file with the name "resolve6.js" and copy the following code snippet. After creating the file, use the command "node resolve6.js" to run this code as shown in the example below −// dns.resolve6() Demo Example // Importing the dns module const dns = ... Read More

491 Views
The dns.resolveMx() method uses the DNS protocol to resolve mail exchange (MX) records for the hostname. The addresses argument passed to the callback function will contain an array of objects containing both the priority and exchange objects.Syntaxdns.resolveMx(hostname, callback)Parametershostname – This parameter takes input for hostname to be resolved.callback – This function will catch errors, if any.records – Returns Mx records for the hostname.Example 1Create a file with the name "resolveMx.js" and copy the following code snippet. After creating the file, use the command "node resolveMx.js" to run this code as shown in the example below −// dns.resolveMx() Demo Example ... Read More

145 Views
The process.report.directory property is used to get or set the directory where the report is written. The default value is the empty string that indicates the reports are written to the current working directory of the Node.js Process.Syntaxprocess.report.directoryExample 1Create a file with the name "directory.js" and copy the following code snippet. After creating the file, use the command "node directory.js" to run this code as shown in the example below −// process.report.directory Property Demo Example // Importing the process module const process = require('process'); // Assigning a directory to store process.report.directory = "/tutorialsPoint" // Printing the result ... Read More

242 Views
The dnsPromises.resolveMx() method uses the DNS protocol to resolve the mail exchange records (MX Records) for the hostname. The promise is resolved with an array of objects containing both a priority and exchange property on success.SyntaxdnsPromises.resolveMx( hostname )where, hostname is the parameter that takes the input for the hostname to be resolved.Example 1Create a file with the name "resolveMx.js" and copy the following code snippet. After creating the file, use the command "node resolveMx.js" to run this code as shown in the example below −// dns.resolveMx() Demo Example // Importing the dns module const dns = require('dns'); const ... Read More