
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

5K+ Views
The crypto.createCipheriv() method will first create and then return the cipher object as per the algorithm passed for the given key and authorization factor (iv).Syntaxcrypto.createCipheriv(algorithm, key, iv, options)ParametersThe above parameters are described as below −algorithm – It takes the input for the algorithm that would be used to create the cipher. Some possible values are: aes192, aes256, etc.key – It takes input for the raw key that is used by the algorithm and iv. Possible values can be of type: string, buffer, TypedArray or DataView. It can optionally be a type object of secret type.iv – Also known as the initialization vector. This ... Read More

655 Views
The cipher.update() is used to update the cipher with the receivd data according to the given encoding format. It is one of the inbuilt method that is provided by the class Cipher within the crypto module. If an input encoding is specified, the data argument is a string, else the data argument is a bufferSyntaxcipher.update(data, [inputEncoding], [outputEncoding])ParametersThe above parameters are described as below −data – It takes the data as an input that is passed to update the cipher content.inputEncoding – It takes the input encoding as a parameter. Possible input values are hex, base64, etc.outputEncoding – It takes the output encoding as ... Read More

773 Views
The cipher.final() is used to return a buffer or string containing the value of cipher object. It is one of the inbuilt method that is provided by the class Cipher within the crypto module. If an output encoding is specified, a String is returned. If an output encoding is not specified a buffer is returned. Calling the cipher.final method more than once will throw an error.Syntaxcipher.final([outputEncoding])ParametersThe above parameters are described as below −outputEncoding – It takes the output encoding as a parameter. The input type for this parameter is string. Possible input values are hex, base64, etc.ExampleCreate a file with name ... Read More

4K+ Views
The async module provides different functionalities to work with asynchronous JavaScript in a nodejs application. The async.queue() method returns a queue that is further used for concurrent processing of processes i.e. multiple processing of items at a time/instant.Installing and Using async.queue()Step 1 − Run the following command to initialize the node package manager.npm initStep 2 − Installing the async module using the following command.npm install --save asyncStep 3 − Importing the async module using the below statement in your programs .const async = require('async')Syntaxasync.queue('function', 'concurrency value')ParametersThe above parameters are described as below −function – This parameter defines the function that will ... Read More

573 Views
The agent.maxSockets property defines the number of sockets that can be concurrently opened by the agent for each origin. By default, this value is set to Infinity. This is also a part of the 'http' module.Syntaxagent.maxSockets: numberParametersThe above function can accept the following Parameters −number – This defines the number of concurrent sockets an agent can have. Its default value is set to Infinity.ExampleCreate a file with name – maxSockets.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below:node maxSockets.jsmaxSockets.js// agent.maxSockets method Demo example // Importing ... Read More

483 Views
The agent.maxFreeSockets property defines the number of sockets that are left open while in the free state. This is a part of the 'http' module interface.Syntaxagent.maxFreeSockets : numberParametersThe above function can accept the following parameters −number – This defines the number of sockets that can be kept open in the free state. Its default value is set to 256.ExampleCreate a file with name – maxFreeSockets.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −node maxFreeSockets.jsmaxFreeSockets.js −// agent.maxFreeSockets method Demo example // Importing the http & ... Read More

4K+ Views
The crypto.randomBytes() generates cyprtographically strong pseudo-random data. This method will not be completed until there is sufficient entropy in the bytes created. But even after this it does not takes more than a few milliseconds. This method basically creates a few random bytes which are further used.Syntaxcrypto.randomBytes(size, [callback])ParametersThe above parameters are described as below −size – This argument defines the number of bytes to be generated. Size must not be greater than 2**31 – 1.callback – The callback is called if any error occurs in the method.ExampleCreate a file with name – randomBytes.js and copy the below code snippet. After creating file, ... Read More

1K+ Views
The crypto.pbkdf2Sync(), also known as Password-Based Key Derivation function 2, provides a synchronous implementation of the derivative function. A key is derived by using the Hmac digest of a specified algorithm from password, salt and iterations. This will create the key in a sync process.Syntaxcrypto.createHmac(algorithm, key, [options])ParametersThe above parameters are described as below −password – Password defined for getting key of the requested byte length. Possible values are of type string, DataView, Buffer, etc.salt – Similar to password for getting the key. Possible values are of type string, DataView, Buffer, etc.iterations – Getting the desired key of requested byte length. It accepts ... Read More

1K+ Views
The crypto.pbkdf2(), also known as Password-Based Key Derivation function, provides an asynchronous implementation of the derivative function. A key is derived by using the Hmac digest of a specified algorithm from password, salt and iterationsSyntaxcrypto.createHmac(algorithm, key, [options])ParametersThe above parameters are described as below −password – Password defined for getting key of the requested byte length. Possible values are of type string, DataView, Buffer, etc.salt – Similar to password for getting the key. Possible values are of type string, DataView, Buffer, etc.iterations – Getting the desired key of requested byte length. It accepts the value as number.keylen – This is the requested byte length of ... Read More

3K+ Views
The crypto.createHmac() method will create a Hmac object and then return it. THis Hmac uses the passed algorithm and key. The optional options will be used for controlling the stream behaviour. The key defined will be the HMAC key used for generating cryptographic HMAC hash.Syntaxcrypto.createHmac(algorithm, key, [options])ParametersThe above parameters are described as below −algorithm – This algorithm is used for generating the Hmac objects. Input type is string.key – Hmac key used for generating the cryptographic Hmac hash.options – These are optional parameters which can be used for controlling the stream behaviour.encoding – String encoding to use.ExampleCreate a file with name – createHmac.js and ... Read More