Mayank Agarwal has Published 410 Articles

Introduction to Sync emptyDir() in NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:37:47

202 Views

This method is used to empty a directory whether it is empty or not with a sync process. If the directory is not empty, it will remove all its contents and empty it. A new empty directory is created if the directory does not exist.SyntaxemptyDirSync(dir)Parametersdir – This is a string ... Read More

EmptyDir() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:36:08

242 Views

Introduction to Async emptyDir()This method is used to empty a directory whether it is empty or not. If the directory is not empty it will remove all its contents and empty it. A new empty directory is created if the directory does not exist.SyntaxemptyDir(dir, [, callbacks])Parametersdir – This is a ... Read More

Dropping a MySQL Table using NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:34:02

479 Views

You can delete an existing table from MySql Database using the "DROP TABLE" statement in Node. Sometimes, we need to delete the whole table, though in corporates it is always advised to archive the tables which are not in used instead of deleting them.While deleting a table, we have two ... Read More

Difference between process.cwd & _ _dirname in NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:30:12

395 Views

NodeJS is a JavaScript runtime environment that was built on top of Chrome's V8 engine. The traditional use of JavaScript is to be executed in browsers, but with Node.JS we can execute JavaScript other than browsers like servers, hardware devices, etc.process.cwd()The process object lies under the global object known as ... Read More

Difference between console.log and process.stdout.write in NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:27:06

840 Views

Both the methods – console.log and process.stdout.write have a basic definition to write or print the statements on the console. But, there is a slight difference in the way they execute these tasks. Internally, console.log implements process.stdout.write which itself is a buffer stream that will be used to directly print ... Read More

Deleting records in MySQL using Nodejs

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:21:34

557 Views

After insertion, we need to delete records as well. The records should can be deleted based upon an identifier from the database table. You can delete records from table using "DELETE FROM" statement.We can delete the records from MySql DB in two ways −Static Deletion - In this type of ... Read More

Creating a MySQL table using Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:17:53

641 Views

Generally, NoSQL databases (like MongoDB) are more popular among the Node developers. However, it totally depends upon your usecase and choice to choose any DBMS from different database options present. The type of databse you choose mainly depends upon one's project's requirements.For example, if you need table creation or real-time ... Read More

Creating a MySQL Table in NodeJS using Sequelize

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:15:06

2K+ Views

Introduction to SequelizeSequealize follows the promise-based Node.js ORM for different servers like – Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server.Following are some of the main features of NodeJS sequelize −Transaction SupportRelationsEager and Lazy LoadingRead Replication and more...Connecting to MySQL using SequelizeWe need to establish a connection between MySQL and ... Read More

Connecting MongoDB with NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:11:43

1K+ Views

Introduction to mongodb.connectThis method is used to connect the Mongo DB server with our Node application. This is an asynchronous method from MongoDB module.Syntaxmongodb.connect(path[, callback])Parameters•path – The server path where the MongoDB server is actually running along with its port.•callback – This function will give a callback if any error ... Read More

Async Copy in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 09:08:43

624 Views

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

Advertisements