FS modules using node js
Code:-
// require the file module
const fs = require('fs')
// read the file content of the using the file module inbuild function .... utf -8 is the character set of hai
let text = fs.readFileSync('test.txt','utf-8')
// agar apko replace karna hai to aap replaace function ka use kar sakte hai
console.log("original content show hota hai ")
console.log(text);
let newContent = text.replace("vishal","Rohan");
console.log("Reoplace content show hota hai ")
console.log(newContent)
console.log("File is exists or not (ye true or false retrun karta hai )= " + fs. existsSync('test.txt'))
console.log("Status of the file= " + fs.stat('test.txt'))
Thanks you for commenting your questions. I will see question and respond you.