Mayank Agarwal has Published 380 Articles

URLSearchParams entries & forEach in Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:05:54

376 Views

Introduction to entries() −This function returns an iterator that allows us to iterate all over the entry set that are present in the object. It basically gives us a tool to iterate over the complete entry set of the param object.SyntaxURLSearchParams.entries();It will return an ES6 type iterator with all the ... Read More

Sync vs Async vs Async/Await in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 07:00:22

305 Views

Introduction to fs-extraBefore proceeding with fs-extra, one must have a basic knowledge of the fs file system. The fs-extra is an extension of the fs file system and has more methods than it. It adds some file method systems that are not there in the naive fs modules. Fs-extra adds ... Read More

Sync Copy in fs-extra using NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:58:19

1K+ Views

Introduction to Sync copyThis method copies files or directories from one location to another location in a sync process. The directory can have sub-directories and files.SyntaxcopySync(src, dest[, options])Parameterssrc – This is a string paramter which will hold the source location of the file or directory that needs to be copies. ... Read More

readJson() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:44:41

464 Views

readJson() method reads a JSON object and then parses it into an object.SyntaxreadJson(file [, options] [, callback])Parametersfile – String parameter which will contain name and location of the file holding the JSON.options – The 'outputFile' function supports the following options −encoding – Default 'null'.flag – Default 'r'. The flag 'r' opens a file for ... Read More

Querying Data from Table using Node

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:41:32

149 Views

In this article, we will see how to select or query the data from a database based on different table fields and columns.Before proceeding, please check the following steps are already executed −mkdir mysql-testcd mysql-testnpm init -ynpm install mysqlThe above steps are for installing the Node - mysql dependecy in ... Read More

pathExists() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:39:12

272 Views

Introduction to Async pathExists()This method will test whether the given path exists or not by checking with the file system. It will throw error in callback if the path does not exist.SyntaxpathExists(file[, callback])Parametersfile – This is the path of the file that needs to be checked in all the file ... Read More

outputFile() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:35:38

294 Views

Introduction to Async outputFile()This method is similar to write file of 'fs'. The only difference is it will create the parent directories, if not present. The argument passed should always be a file path, not a buffer or a file descriptor.SyntaxoutputFile(file, data[, options] [, callback])Parametersfile – String parameter which will ... Read More

NodeJS - Exception Handling in Synchronous Code

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:24:19

126 Views

An exception is a type of an event that occurs while executing or running a program that stops the normal flow of the program and returns to the system. When an exception occurs the method creates an object and gives it to the runtime system. This creating an exception and ... Read More

NodeJS - Exception Handling in eventful Code

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:22:07

275 Views

An exception is a type of an event, that occurs while executing or running a program that stops the normal flow of the program and returns to the system. When an exception occurs the method creates an object and gives it to the runtime system. This creating an exception and ... Read More

NodeJS - Exception Handling in Asynchronous Code

Mayank Agarwal

Mayank Agarwal

Updated on 28-Apr-2021 06:19:38

177 Views

An exception is a type of an event that occurs while executing or running a program that stops the normal flow of the program and returns to the system. When an exception occurs the method creates an object and gives it to the runtime system. This creating an exception and ... Read More

Advertisements