1 of 14

FS Modules

Web Technology

Subin Sahayam, Rourab Paul Assistant Professor,

Department of Computer Science and Engineering

Shiv Nadar University

2 of 14

Web Application Architecture

K2

3 of 14

FS Module

  • Built-in Module
  • Helps Interact with File System
    • API to Interact with Files in the Computer
  • File and Directory Operations
    • Creating
    • Reading
    • Writing
    • Deleting

K1

4 of 14

FS Module

  • Built-in Module
  • Helps Interact with File System
    • API to Interact with Files in the Computer
  • File and Directory Operations
    • Creating
    • Reading
    • Writing
    • Deleting
  • Supports - Synchronous and Asynchronous Operations

K1

5 of 14

FS Module – Reading a File

K3

fs.readFile()

↓

┌──────────────────┐

│ callback │

│ │

│ err → Was there an error? │

│ data → What was read? │

└──────────────────┘

6 of 14

FS Module – Writing to a File

K3

7 of 14

FS Module – Append to a File

K3

8 of 14

FS Module – Deleting a File

K3

9 of 14

FS Module – Create Directory

K3

10 of 14

FS Module – Index.html

K3

11 of 14

FS Module – Index.html

K3

12 of 14

FS Modules

K3

13 of 14

References

​

​

​

​

​

  1. Evan Hahn, “Express in Action: Writing, Building, and Testing Node.js Applications" – 15 April 2016, First Edition.
  2. Brad Dayley, Brendan Dayley, Caleb Dayley, “Node.js, MongoDB and Angular Web Development: The definitive guide to using the MEAN stack to build web applications”, Pearson Education, Second Edition, 2017.
  3. Greg Lim, “Beginning MERN Stack: Build and Deploy a Full Stack MongoDB, Express, React, Node.js App,” 2021.

​

14 of 14

THANK YOU