Mayank Agarwal has Published 380 Articles

Introduction to ensureFileSync() in NodeJS

Mayank Agarwal

Mayank Agarwal

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

267 Views

This method is used to ensure that a file exists at the given location by using a sync process. The response will only be given after the processing is completed. If the files that is ensured to be created is not present or the respective directories are not present, these ... Read More

ensureFile() function in fs-extra - NodeJS

Mayank Agarwal

Mayank Agarwal

Updated on 27-Apr-2021 11:07:21

162 Views

Introduction to Async ensureFile()This method is used to ensure that a file exists at the given location. If the files that is ensured to be created is not present or the respective directories are not present, these directories and files are created. If the file already exists, it is not ... Read More

Introduction to Sync emptyDir() in NodeJS

Mayank Agarwal

Mayank Agarwal

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

221 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

266 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

502 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

422 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

911 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

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

684 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