- Trending Categories
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 254 Articles for Node.js
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
570 Views
The util.isDeepStrictEqual() method as the name suggests, is used for checking whether the two values are deep strict equal or not. If both the values are deep strict equal, true is returned else it returns false.Syntaxutil.isDeepStrictEqual(val1, val2)Parametersval1 & val2 – Both the input parameters can accept class, function, object or a JavaScript primitive value. The above function checks the equality between these two values.Example 1Create a file with the name "deepStrictEqual.js" and copy the following code snippet. After creating the file, use the command "node deepStrictEqual.js" to run this code.// util.isDeepStrictEqual() Demo Example // Importing the util module const util = require('util'); ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
4K+ Views
The forEach() method in Node.js is used for iterating over a set of given array items. One can iterate over all the values of the array one-by-one using the forEach array loop.SyntaxarrayName.forEach(function)Parametersfunction − The function takes input for the method that will be executed.arrayName − Array that will be iterated.Example 1Create a file "forEach.js" and copy the following code snippet. After creating the file, use the command "node forEach.js" to run this code. Live Demo// forEach() Demo Example // Defining a vehicle array const vehicleArray = ['bike', 'car', 'bus']; // Iterating over the array and printing vehicleArray.forEach(element => { console.log(element); ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
481 Views
The Hmac class is one of the many utility classes that is used for creating the cryptographic HMAC digests. The Hmac.update() method is used for updating the Hmac content with the data passed. If encoding is not provided and the data is in string format, then the default encoding 'utf8' is enforced.Syntaxhmac.update(data, [encoding])ParametersThe parameters are described below:data − This input parameter takes input for the data with which Hmac will be updated.encoding − This input parameter takes input for the encoding to be considered while updating the Hmac.Example 1Create a file with the name "hmacUpdate.js" and copy the following code snippet. After ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
262 Views
The util.deprecate() method wraps fn (that may be a function or class) in such a way that it is marketed as a deprecated method. The util.deprecate() method returns a function that emits a DeprecationWarning. This warning is printed to the stderr when the function is called the first time. The function is called without any warning once the warning is emitted.Syntaxutil.deprecate( fn, msg, [code] )ParametersThe parameters are defined below:fn − The function that needs to be deprecated.msg − This is a warning message which is invoked once the deprecated function is called.code − This is an optional parameter which displays the passed ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
46 Views
The util.types.isBoxedPrimitive() method checks whether the passed value is a built-in Primitive object or not. If the above condition is satisfied, it returns True, else False. Primitive object includes new Boolean(), new String() or Object(Symbol()).Syntaxutil.types.isBoxedPrimitive(value)Parametersvalue − This input value takes input for the required parameter and checks if it's a Float32-Array instance or not.It returns True or False based upon the input value passed.Example 1Create a file with the name "isBoxedPrimitive.js" and copy the following code snippet. After creating the file, use the command "node isBoxedPrimitive.js" to run this code.// util.types.isBoxedPrimitive() Demo Example // Importing the util module const util ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
6K+ Views
The buffer object can be encoded and decoded into Base64 string. The buffer class can be used to encode a string into a series of bytes. The Buffer.from() method takes a string as an input and converts it into Base64.The converted bytes can be changed again into String. The toString() method is used for converting the Base64 buffer back into the string format.SyntaxBuffer.from(string, [encoding]) object.toString(encoding)ParametersThe parameters are described below:string − This input parameter takes input for the string that will be encoded into the base64 format.encoding − This input parameter takes input for the encoding in which string will be encoded and ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
2K+ Views
The util.format() method returns a formatted string that will use the first argument as a printf like format string. This format can also contain zero or more format specifiers. These specifiers can be replaced with the converted value from the corresponding argument.Following are some of the formatted specifiers:%s − String will be used to convert all values except bigInt, object and -0.%d − In this case, number will be used to convert all values except BigInt and symbo%i − parseInt(value, 10) will be used for all values except BigInt and symbol.%f − parseFloat(value) will be used for all values except Symbol%j − This format ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
424 Views
The util.callbackify() method takes an async function as a parameter (or a function with Promise) and returns a function with the callback style. The callback will hold the rejection reason as the first parameter (or null in case of Promise) and the resolved value as the second parameter.Syntaxutil.callbackify(function)Parametersfunction − The input parameter for the async_function required for callback.Example 1Create a file "callbackify.js" and copy the following code snippet. After creating the file, use the command "node callbackify.js" to run this code.// util.callbackify() demo example // Importing the util module const util = require('util'); // Defining a simple async function ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
840 Views
The Hmac class is one of the many utility classes that is used for creating the cryptographic HMAC digests. The Hmac.digest() method is used for calculating all the data that is updated using the Hmac.update() method. If encoding is provided, a string will be returned, else a buffer is returned.Syntaxhmac.digest( [encoding] )Parametersencoding − This input parameter takes input for the encoding to be considered while calculating hmac.Example 1Create a file "hmacDigest.js" and copy the following code snippet. After creating the file use, use the command "node hmacDigest.js" to run this code. Live Demo// Hmac.digest() Demo Example // Importing the crypto module ... Read More
![Mayank Agarwal](https://www.tutorialspoint.com/assets/profiles/333719/profile/60_290052-1619507248.jpg)
185 Views
The Hash class is one of the many utility classes that is used for creating the hash digests of data. The hash.copy() method creates a new Hash object that will contain a deep copy of the internal state of the current hash object.Syntaxhash.copy([options])Parametersoptions −This input parameter takes input to control the stream behaviour and therefore will contain the stream.tranformOptions.Example 1Create a file "hashCopy.js" and copy the following code snippet. After creating the file, use the command "node hashCopy.js" to run this code.// hash.update() demo Example // Importing the crypto module const crypto = require('crypto'); // Defining the hash ... Read More