Node.js crypto.generateKeyPairSync() Method
The crypto.generateKeyPairSync() method is an inbuilt application programming interface of crypto module which is used to generate a new asymmetric key pair of the specified type. For example, the currently supported key types are RSA, DSA, EC, Ed25519, Ed448, X25519, X448, and DH. Moreover, if option’s publicKeyEncoding or privateKeyEncoding is stated here, then this function acts as if keyObject.export() had been called on its output. Else, the particular part of the key is returned as a KeyObject. However, it is suggested to encode the public keys as ‘spki’ and private keys as ‘pkcs8’ with a strong passphrase, in order to keep the passphrase secret....
read more
Difference between Synchronous and Asynchronous Method of fs Module
Asynchronous fs methods in Node.js do not block the event loop and handle multiple operations concurrently, improving performance while Synchronous fs methods block the event loop until the operation completes, which can lead to inefficiencies and slower performance for I/O-bound tasks....
read more
Node.js util.inspect() Method
The “util” module provides ‘utility’ functions that are used for debugging purposes. For accessing those functions we need to call them by ‘require(‘util’)’....
read more
Node.js HTTP Module Complete Reference
To make HTTP requests in Node.js, there is a built-in module HTTP in Node.js to transfer data over the HTTP. To use the HTTP server in the node, we need to require the HTTP module. The HTTP module creates an HTTP server that listens to server ports and gives a response back to the client....
read more
Node.js fs.lstatSync() Method
The fs.lstatSync() method is used to synchronously return information about the symbolic link that is being used to refer to a file or directory. The fs.Stat object returns several fields and methods to get more details about the file....
read more
Node.js crypto.privateDecrypt() Method
The crypto.privateDecrypt() method is used to decrypt the content of the buffer with privateKey.buffer which was previously encrypted using the corresponding public key, i.e. crypto.publicEncrypt()....
read more
Node.js fs.truncate() Method
The fs.truncate() method in node.js is used to change the size of the file i.e either increase or decrease the file size. This method changes the length of the file at the path by len bytes. If len represents a length shorter than the file’s current length, the file is truncated to that length. If it is greater than the file length is padded by appending null bytes (x00) until len is reached....
read more
Node.js crypto.randomInt() Method
The Crypto.randomInt method in Node.js is an inbuilt application programming interface of the crypto module which is used to create a random integer synchronously or asynchronously based on our usage....
read more
Node.js File System Complete Reference
Node.js File System module is used to handle file operations like creating, reading, deleting, etc. Node.js provides an inbuilt module called FS (File System). Node.js gives the functionality of file I/O by providing wrappers around the standard POSIX functions. All file system operations can have synchronous and asynchronous forms depending on user requirements...
read more
Node.js Buffer.concat() Method
The Buffer.concat() method is used to concat all buffer objects in a given array into one buffer object. The return value of this method is also a buffer. If the length of the buffer is not provided then it is calculated from the Buffer instances in the list....
read more
Node.js new Agent() Method
The Node.js HTTP API is low-level so that it could support the HTTP applications. In order to access and use the HTTP server and client, we need to call them (by ‘require(‘http’)‘). HTTP message headers are represented as JSON Format....
read more
Node.js crypto.pbkdf2Sync() Method
The crypto.pbkdf2Sync() method gives a synchronous Password-Based Key Derivation Function 2 i.e, (PBKDF2) implementation. Moreover, a particular HMAC digest algorithm which is defined by digest is implemented to derive a key of the required byte length (keylen) from the stated password, salt, and iterations....
read more