i
Creating a Web Server
Handling Get Requests
Handling Post Requests
Event Handling
Event Loop
Routing
Streams
Debugging a Node application
Framework in Node.js
Express.js
Templating Engine
Invoking a REST Service
Pre-requisites for Node.js
Introduction to Node.js
What to use Node.js for?
Node.js - Environment Setup
REPL Terminal
For executing file operations, Node comes bundled with fs module.
fs module provides API for interacting with the file system, which is modeled around POSIX functions. All File system operation provided by fs is in synchronous as-well-as asynchronous form.
It is recommended using asynchronous functions.
fs module can be imported in your application for using File System operations.
It also provides support for URL objects.
const fs=require('fs')
same directory.
We used readFile function provided by the fs module. This function reads the file in an Asynchronous manner.
Fs-demo.js
Output on running the above code using
>Nodemon fs-demo.js
Similarly, we have readFileAsync function, which does the same operation as readFile but synchronously.
We have other operations like writeFile, opening the file, rename file, etc. which we are not discussing
Don't miss out!