Mayank Agarwal has Published 380 Articles

Node.js – util.types.isBoxedPrimitive() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Aug-2021 11:42:45

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 ... Read More

Node.js – Base64 Encoding & Decoding

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:18:20

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() ... Read More

Node.js – util.format() method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:14:39

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 ... Read More

Node.js – util.callbackify() Method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:12:32

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 ... Read More

Node.js – hmac.digest() Method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:10:41

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( ... Read More

Node.js – hash.copy() Method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:08:01

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 ... Read More

Node.js – util.inherits() Method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:04:46

360 Views

The util.inherits() method basically inherits the methods from one construct to another. This prototype will be set to a new object to that from the superConstructor.By doing this, we can mainly add some validations to the top of Object.setPrototypeOf(constructor.prototype, superConstructor.prototype).Syntaxutil.inherits(constructor, superConstructor)ParametersThe parameters are described below -constructor − This is a function ... Read More

Node.js – util.inspect() method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 12:01:15

943 Views

The util.inspect() method returns the string representation of the objects that are intended for the debugging process.Syntaxutil.inspect(object, [showHidden], [depth], [colors])ParametersThe parameters are defined as below:object − A JavaScript primitive type or an object is given as input.optionsshowHidden − This is set as false by default. If true, this option includes the ... Read More

Timing features in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 11:57:15

523 Views

The timer module in Node.js consists of different functions that can control and alter the timings of code execution. In this article, we will see how to use some of these functions.setTimeout() MethodThe setTimeout() method schedules the code execution after a designated amount of milliseconds. Only after the timeout has ... Read More

Node.js – util.types.isInt32Array() Method

Mayank Agarwal

Mayank Agarwal

Updated on 16-Aug-2021 11:51:42

59 Views

The util.types.isInt32Array() method checks whether the passed value is a built-in Int32Array instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isInt32Array(value)Parametersvalue − This input takes input for the required parameter and checks if it's an Int32Array instance or not. Returns True or False based upon the ... Read More

Advertisements