File Handling in NodeJS
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- Hey Everyone, In this video, we will look at file handling in NodeJS. We'll see how to create, write, read and delete files using FS module in NodeJS.
► Complete Full Stack Web Developer RoadMap 2023: • Complete Full Stack We...
► Master NodeJS Playlist: • Master NodeJS
Quick Links
Node.JS Website: nodejs.org/en/
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It allows developers to run JavaScript on the server side, creating server-side applications with JavaScript.
► My Website: www.piyushgarg...
My Gears
► My Girlfriend: amzn.to/3WD6FRp
► Apple MacBook Laptop: amzn.to/3WBJgQn
► Anker USB Hub: amzn.to/3GhZSr0
► Blue Yeti Microphone: amzn.to/3YKZ9FT
► External 27” Monitor: amzn.to/3Vp3xaO
► Logitech MK295 Wireless Keyboard and Mouse: amzn.to/3DuL1bB
► Seagate Expansion 1TB External HDD: amzn.to/3QMm5Q8
► Tripod: amzn.to/3S4OwK4
► Ring Light: amzn.to/3YLf8DR
Disclaimer: All the links above are affiliate links.
Social Links
► Twitter - / piyushgarg_dev
► LinkedIn - / piyushgarg195
Video Titles
What is NodeJS?
How does NodeJS Work?
File Handing NodeJS
FS Module NodeJS
Modules in NodeJS
Require Function in NodeJS
Exports in NodeJS
NodeJS in Hindi
Tags
#nodejs #javascript #developer #javascriptinhindi #webdevelopment #webapp #realtimeapp #serverside #nonblockingio #tech
Saw many tutorials but none of them where better than you ... Need to say you are underrated tutor on TH-cam...
100% agree to this .♥
You're a really great teacher, I haven't seen such a detailed and clear explanation anywhere. Thanks a bunch!
Wow. Just 3 videos and i am loving node. You explain it so fluently. Had a habit of making notes for help in future but you created permanent notes in my head:) This tutorial is the best‼️
bhiaya aap ne bhot help ki hai meri Har concept me aap se Javascript, react or next padhi thi ab backend start kar rha hu
aap ko dil se thank you❤
I am actually getting curious about learning more in Nodejs after watching your tutorials, you explain it in very easy way. Thank you so much , keep up the good work
A Genuine Thank you, I've been struggling to understand node js and express. up to this video I understood everything and hope express will also be as good as node explanation. But also same thing is happing in react also i hope i can understand react later.
Can anyone suggest best react tutorials? (except codewithharry)
Again, Thanks Piyush Bhai ❤
Now that i learn File Handling from you. Its time to post a video on my youtube channel to make sure i understand it well enough. Thanks sir.
can you tell which vs code extension he is using for node js
@@saurabhmaurya4199 yes bro I also want to know which extension is it
I completed one playlist of nodejs... But there are no detailed like this... Thanks
Thanks piyush for really helpful tutorial
amazing teacher, I'm following you to learn NodeJS.
Literally this is the only playlist to become master of node. Js ❤❤❤wow yrrr what a playlist 🥰🥰😘😘😘
This is Complete beginner friendly to advance concepts and very deep series. ✅
A very big thanks, bro. You're explaining each topic in the finest way.
You realy explained it well. Your way of giving clearification is so good..
your turorials are one of the best. please we need best practices and architecture use in node project tutorial.
we can almost anything related to file e.g create edit delete
these are not available in normal js
const fs = require("fs")
there are two types of commands for file handling sync and async
// sync can return value that we can store in a variable
const data = fs.readFileSync("file.txt", "utf8");
console.log(data);
// sync requires a try and catch to handle error
const fs = require('node:fs');
try {
const stats = fs.statSync('/Users/joe/test.txt');
} catch (err) {
console.error(err);
}
// async can't return value so we can't store it in a variable
fs.readFile("file.txt", "utf8", (err, data) => {
console.log(data);
});
// async needs a call back where we can handle error
const fs = require('node:fs');
fs.stat('/Users/joe/test.txt', (err, stats) => {
if (err) {
console.error(err);
}
// we have access to the file stats in `stats`
});
thanks yarr
87K people watched, but only 1.7K liked ! Hey people, if this course is free, it doesn't mean it's not worthy..this course is much better than many paid ones.
This course is better then pain courses ... Glad i found it..
amazing and detailed Explanation..Thank you for providing in-depth knowledge..Keep posting and keep guiding.
Thanks for your videos.. your narration is excellent
your way of teaching is awesome ,i just loved it .
Pta nhi mujhe kyun lag raha hai yeh banda mujhe node.js sikha k chodega....😊
After wondering many channels (like code with harry, coderdost) i am on right place.....thanks bhai❤❤❤
your way of explanation is too good♥♥♥♥👍👍👍👍
Make more videos on JavaScript projects and nodejs projects
sir can you make angular for beginners series your way of teaching is too good
good and well
done explain
Really good explanation
Thank you so much Bhai for providing this level of content for free ❤
very very Good And beginner level content very easy to learn with piyush
One of the best Node.js playlist🔥
You are explanation to good 👍
You explanation is superb bro
yaar bro kya padhate ho
maja aa gya
Really good explanation.
Awesome course better than many paid courses also i have a question which vs code theme are you using?
Also can you make a video on your vs code setup key binding and extension you used that will be fun to watch waiting for you reply🙌🏽❤️
explained very clearly thank you sir!!!!!!!
Your video are amazing; Please share link of your codes also
thank you very much bro continue making easy tutorials pls
Bhaiya you are the best. 🏆🏆
thank you so much bro 💕
Thank You Sir
super I am enjoying learning. Thanks
nicely explained ... Thanku
Simple word explanation. 🎉🎊
this is helpful ❤
amazing
Thanku for such a nice explanation!
Nice Explanation
hey there can anyone tell me which snippet to install for node js as There is no suggestion is showing in visual code
Badhiya lecture tha
Just subscribed your Channel and exploring more contents of yours
Summary:
Create file
writeFileSync
writeFile
For read a file
readFileSync
readFile = expect call back func
append in file
appendFileSync
Copy file
cpSync
For delete file
unlinkSync
For Statics
statSync
For creating a folder
mkdirSync
Very nice explanation...
best quality content for free
bro, can you please write code in the ES6 way, since I am just start learning , I want to start with the best practice in place. Also can you show everything in class way, how people use them in production. Please talk about socket API as well.. I tried the P2P project, google meet like conferencing tutorial of yours and find it difficult. So, if you kindly talk about the basics, then that would be real help
Don't Worry! We are going to cover each and everything in this playlist and make super easy for you to understand. After this playlist you'll be able to follow P2P as well with ease.
hey im preparing for MERN stack. right now i have completed js and react. can you guide me that do this node js serice is beneficial for me as in a queue of javascript-react,node js, express -mongo db
what is difference between npm run XXX and npm XXX sir?
npm run xxx used to run command from package.json(scripts) meanwhile npm xxx used to run built in npm commands.
Nice explanation 🔥
is it compulsory to write callback function in async writefile
badiya explaination bro
zabardast🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Great content sir!
Awesome
Thank you❤
can we use the fs module to access any file on our system? or is it just for the files present in our current directory?
Can some one tell any additional plugins to be installed to get intellisense suggestions. I'm not getting any of suggestions for objects created like fs object. Please suggest
just wow
thanks ❤
Thanks bro
I don't have auto suggestion option like the sir can someone tell which extension it is?
Did you find the solution?
bro i dont know how but when I watch videos form this channel the video is always buffering and when I go a bit forward, it starts working! and it stops again
Bro there is a issue when using appendSync function your file appends the given text every time you run your code but in my case I am using same code but my text is appended only once and then remains same even if I run it 5 times
Please describe why is it so.
you need to comment out the writeFileSync and readFileSync lines . The reason is everytime the file.js is getting executed the writeFIleSync is deleting the previous demo.txt and creating a new demo.txt with the content passed to it and then it's appending the content of the appendFileSync .
require keyword not appearing in code completion in VS code please help me
Bro mereme sare suggestions show nhi hote mujhe pura likhna pdta h fs.writefile pura likhne me even control space se bhi nhi hote....any suggestions kese theek ho skta h
getting error Error: Cannot find module 'C:\Users\iamyo\OneDrive\Desktop\NodeJs\file.js'
solved now
what does {recursive : true} do?
when writing fs.writeFileSync("./test.text") it is showing error as module not found and writeFileSync is not a function please help
npm i fs
💥💥
Lovely
Sir mere vs code par ye automatic suggestions ni aa rahe hai file.readsync aesa
Did you find the solution?
just wow...
can you please provide the source code as well for your videos
can you please provide the github link of these code files
fs.writeFilesync("./test.txt", "Hello world")
^
TypeError: fs.writeFilesync is not a function
anyone have node js handwritten notes
8:19 Galt bol diye h vo.. WriteFile sync nhi h vo.. Async hi hai hai na
vid-5 ✅
👍👍👍👍👍👍👍
Sir new video kab tak upload karenge aap
Done :)
👍👍
53 Comments
53 Comments
53 Comments
53 Comments
53 Comments
You're a really great teacher, I haven't seen such a detailed and clear explanation anywhere. Thanks a bunch!
amazing