From 88eb8e76b12d29df46ebe0c241eb951812ec796a Mon Sep 17 00:00:00 2001 From: Divyansh Kumar Singh <102811377+singhdivyansh0009@users.noreply.github.com> Date: Sun, 30 Apr 2023 17:38:55 +0530 Subject: [PATCH] Add files via upload --- .../asyncronus_file_system/bio/Data.txt | 3 +++ IntroToNode/asyncronus_file_system/index.js | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 IntroToNode/asyncronus_file_system/bio/Data.txt create mode 100644 IntroToNode/asyncronus_file_system/index.js diff --git a/IntroToNode/asyncronus_file_system/bio/Data.txt b/IntroToNode/asyncronus_file_system/bio/Data.txt new file mode 100644 index 00000000..4d8aa57a --- /dev/null +++ b/IntroToNode/asyncronus_file_system/bio/Data.txt @@ -0,0 +1,3 @@ +Name:Divyansh kr singh + DOB:09/11/2001 +Roll No. : 057 \ No newline at end of file diff --git a/IntroToNode/asyncronus_file_system/index.js b/IntroToNode/asyncronus_file_system/index.js new file mode 100644 index 00000000..ac2683c2 --- /dev/null +++ b/IntroToNode/asyncronus_file_system/index.js @@ -0,0 +1,26 @@ +const fs = require("fs"); +//making directory +// fs.mkdir("bio", (err) => { +// console.log("folder is created"); +// }); +// //creating the file and writing data in it +// fs.writeFile( +// "bio/Data.txt", +// "Name:Divyansh kr singh \n DOB:09/11/2001", +// (err) => { +// console.log("file is created"); +// } +// ); +// //adding extra data in file +// fs.appendFile("bio/Data.txt", "\nRoll No. : 057", (err) => { +// console.log("data is appended"); +// }); +//displaying info of the file +let inside_data = fs.readFile("bio/Data.txt", "utf-8", (err, inside_data) => { + console.log(inside_data); +}); + +// //deleting the folder +// fs.rmdir("bio", (err) => { +// console.log("folder deleted"); +// });