Presented By:
Aanchal Agarwal & Deeksha Maurya
(Software Consultant)
Node Modules
Lack of etiquette and manners is a huge turn off.
Session Etiquettes
Punctuality
Respect Knolx session
timings, you are requested not
to join sessions after a 5
minutes threshold post the
session start time.
Feedback
Make sure to submit a
constructive feedback for all
sessions as it is very helpful
for the presenter.
Silent Mode
Keep your mobile devices in
silent mode, feel free to move
out of session in case you need
to attend an urgent call.
Avoid Disturbance
Avoid unwanted chit chat
during the session.
Agenda
Overview
01
02
03
04
05
Types of node modules
Built-in modules
What are node modules?
Creating own modules
06 Third party modules
Overview
What are Node Modules?
● In Nodejs, Modules are a small encapsulated unit, which we
can reuse, share with anyone and its easier to maintain. It can
be a single file or a collection of multiple files or folders.
● Or we can say a set of a function which we want to include in
our application.
Types of Modules
Third-Party Modules
Modules
Local Modules Built-In/ Core Modules
Local Modules
● In Nodejs, if we want to add set of functionality in our project,
we can create it locally and use them, this locally created
functionality is known as local modules.
● To use the function in the entire project we need to export it
with the help of module.export keyword.
Creating own Modules
Built-In/Core Modules
● In Node js, Built-In modules are modules which do not require
any installation. In order to use built-in modules we only need
to import it using require() function.
● Examples: http, fs, path, os, util, url etc. .
File System Module
● File system Module help us access the different file and directory
from our computer.
● const fs = require(‘fs’);
● Common use for the File System module:-
❏ Read Files
❏ Create Files
❏ Update Files
❏ Delete Files
❏ Rename Files
Reading Files
Syntax: fs.readFile(fileName [,options], callback)
Creating & Updating Files
● The File System module has methods for creating new files:
fs.appendFile()
fs.open()
fs.writeFile()
● The File System module has methods for updating files:
fs.appendFile()
fs.writeFile()
Syntax: fs.writeFile(filename, data[, options], callback)
Syntax: fs.appendFile(filename, data[, options], callback)
Delete Files
Syntax: fs.unlink(filename, callback)
Create Directory
Syntax: fs.mkdir(path[, options], callback)
Third Party Modules
● Third party modules are the modules that are available online
using NPM (Node Package Manager).
● These modules can be installed in the project folder or globally.
● Some of the popular third party modules are:- Mongoose,
express and many more.
Install package manager
● Installation
Uninstall package manager
● Uninstall
DEMO
● https://nodejs.org/en/docs
● https://www.w3schools.com/nodejs/nodejs_filesystem.asp
● https://nodejs.dev/learn/nodejs-file-stats
References
Thank You !
Get in touch with us:
Lorem Studio, Lord Building
D4456, LA, USA

Node modules