
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

119 Views
The util.types.isDataView() method checks whether the passed value is a built-in DataView instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isDataView(value)Parametersvalue − This input value takes input for the required parameter and checks if it's a Data View instance or not.It returns True or False based upon the input value passed.Example 1Create a file named "isDataView.js" and copy the following code snippet. After creating the file, use the command "node isDataView.js" to run this code.// util.types.isDataView() Demo Example // Importing the util module const util = require('util'); const buffer = new ArrayBuffer(20); // ... Read More

110 Views
The util.types.isBigInt64Array() method checks whether the passed value is a BigInt64Array instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isBigInt64Array(value)Parametersvalue − This input value takes input for the required parameter and checks if it's a BigInt64 array instance or not.It returns True or False based upon the input value passed.Example 1Create a file named "isBigInt64Array.js" and copy the following code snippet. After creating the file, use the command "node isBigInt64Array.js" to run this code.// util.types.isBigInt64Array() Demo Example // Importing the util module const util = require('util'); // Functions to be passed as parameter // ... Read More

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

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

695 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

379 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

106 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

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

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

593 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