Mayank Agarwal has Published 373 Articles

Node.js – util.inspect() method

Mayank Agarwal

Mayank Agarwal

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

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

659 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

128 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

crypto.privateDecrypt() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:36:53

2K+ Views

The crypto.privateDecrypt() is used for decrypting the given data content by using a private key passed in the parameter that was previously encrypted using the corresponding public key with crypto.publicEncrypt() method.Syntaxcrypto.privateDecrypt(privateKey, buffer)ParametersThe above parameters are described as below −key – It can contain the below 5 types of data of the ... Read More

Stream writable.writableObjectMode Property in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:33:59

219 Views

The writable.writableObjectMode property is used for getting the objectMode property of the given writable Stream. The property will return 'true' if the object mode is set, else 'false' will be returned.Syntaxwriteable.writableObjectModeExampleCreate a file with name – writableObjectMode.js and copy the below code snippet. After creating file, use the following command ... Read More

Stream writable.writableLength Property in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:33:30

236 Views

The writable.writableLength property is used for displaying the number of bytes or objects which are there in the queue that are ready to be written. This is used for inspecting the data as per the status from highWaterMark.Syntaxwriteable.writableLengthExample 1Create a file with name – writableLength.js and copy the below code ... Read More

Stream writable.cork() and uncork() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:30:16

692 Views

The writable.cork() method is used for forcing all the written data to be buffered inside a memory. This buffered data will only be removed from the buffer memory after stream.uncork() or stream.end() method have been called.Syntaxcork()writeable.cork()uncork()writeable.uncork()ParametersSince it buffers the written data. Only parameter that's needed will be the writable data.ExampleCreate ... Read More

urlObject.auth() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:29:12

128 Views

The auth() property defines the username and password portion of any URL, also called as userInfo. The string and username are separated by a colon ( : ).SyntaxurlOject.auth()ParametersSince it retuns only the username and password from a URL, it does not required any input parameters.ExampleCreate a file with name – ... Read More

send(), sendStatus() and json() method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:28:45

5K+ Views

The send() and json() functions are used for sending the response to the client directly from the server. The send() method will send the data in a string format, whereas the json() function will send the same in JSON format. The sendStatus() method is used for sending the HTTP request ... Read More

script.createCachedData() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 13:24:12

177 Views

The script.createCachedData() method is used for creating a code cache that will be used along with the cachedData option of the script constructor. This cachedData can be called multiple number of times without latency. This method is an inbuilt programming interface from the 'script' module.Syntaxscript.createCachedData()ParametersSince it only caches the data. ... Read More

Advertisements