- Create a file
index.js
- Perform the following operations using
fs
module of NodeJS
Note: Each operation should be perfomed synchronously as well as asynchronously
- Create a folder
space_project
- Inside the folder, create a file
log.txt
and add the line "ISRO is planning Gaganyaan mission, ie an Indian crewed orbital spacecraft."
- Now, replace the line in the
log.txt
file with "ISRO has started working on Gaganyaan."
- Append another line to the
log.txt
file " The current Aditya-L1 team of scientists is mentoring new talent for working on the Gaganyaan mission."
- Rename the
log.txt
file toupdate.txt
- Read the
update.txt
file and display the data. Additionally print a line "We are excited" usingconsole.log()
after the read operation
- Delete the file
update.txt
- Delete the folder
space_project