Understanding File System | Understanding Node.js Core Concepts FREE VERSION

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2022
  • Grab the complete and premium version of the course using this link:
    www.udemy.com/course/understa...
    This video is all about the Node.js File system, and by the end of it, you'll master the fs module!
    Final source code of the project: github.com/agile8118/node-fil...
    Next Video: • Understanding Streams ...
    The Course - Free Version: • Understanding Node.js ...
    CORRECTION (December 29):
    I mentioned in the video that the double logs that we get might be something related to the visual studio code, but actually, it turns out it's something related to the fs.watch itself. Apparently, it's unstable and not consistent and sometimes reports events twice. I tried other packages out there but still the same thing. You can try the 'chokidar' package to not get the double logs, but it doesn't report all the events if they happen extremely fast, for example doing a thousand writes to a file. It's something more related to the operating system concepts, I try to dig deeper into this and share the results with you later!

ความคิดเห็น • 82

  • @Cododev
    @Cododev  ปีที่แล้ว +25

    CORRECTION (December 29, 2022):
    I mentioned in the video that the double logs that we get might be something related to the visual studio code, but actually, it turns out it's something related to the fs watch itself. Apparently, it's unstable and not consistent and sometimes reports events twice. I tried other packages out there but still the same thing. You can try the 'chokidar' package to not get the double logs, but it doesn't report all the events if they happen extremely fast, for example doing a thousand writes to a file. It's something more related to the operating system concepts, I try to dig deeper into this and share the results with you later!

    • @gouthamkrishna5490
      @gouthamkrishna5490 ปีที่แล้ว

      You good at explaining when will be next Video

    • @Cododev
      @Cododev  ปีที่แล้ว +1

      ​@@gouthamkrishna5490 Hi Goutham, thanks for your comment. The next video is pretty much complete and will be published within the next 24 hours!

    • @kivanc5789
      @kivanc5789 ปีที่แล้ว +1

      ​@@Cododev I assumed that it could be caused by "save on focus change" setting in vscode. Any updates?

    • @rayforever
      @rayforever หลายเดือนก่อน

      ​@@Cododev I think Indian made that package cuz chokidar means guard or boundry protector 😂😂😂

  • @VladislavSnegurov
    @VladislavSnegurov ปีที่แล้ว +36

    Please, don't stop. Your videos on node.js are the best on youtube. I really really like how you combine basics of computer science with learning node.js concepts. It really gives a deep understanding and allows to be not just a coder, but the programmer. Honestly, your computer science references is half a reason why i so like your videos

    • @Cododev
      @Cododev  ปีที่แล้ว +4

      Thanks Vladyslav! Glad you found the course helpful so far and helped you learn more about computer science and programming!

  • @sidben7048
    @sidben7048 ปีที่แล้ว +24

    Wow you are back , your videos about event emitters and especially the buffers are amazing , thank you sir

  • @abhineetsingh1291
    @abhineetsingh1291 ปีที่แล้ว +5

    0:00 quick summary
    9:30 what is a file
    16:30 How nodejs deals with files
    21:00 Promise Callback and synchronous Apis

  • @MohamedAshraf-uc8zo
    @MohamedAshraf-uc8zo ปีที่แล้ว

    VERY HAPPY TO SEE AN NOTIFICATION FROM YOUR CHANNEL IN THIS PLAYLIST ,, KEEP IT UP

  • @pigra24
    @pigra24 ปีที่แล้ว +2

    I like your tutorials. They've opened my mind to many concepts in nodejs more than most other videos I've watched on TH-cam.
    Keep up with the good work. Thanks

  • @mohitashliya8750
    @mohitashliya8750 ปีที่แล้ว +1

    Expecting more videos from You Sir. The genuinity you provide is out of the world.

  • @user-by1ve7gj8m
    @user-by1ve7gj8m 11 หลายเดือนก่อน +3

    This whole course on Nodejs is amazing.
    Please keep making such quality content man.

  • @WillFlores1
    @WillFlores1 11 หลายเดือนก่อน +2

    I'm feeling confident after watching the first three, thanks for creating these lessons

  • @ryanwright3965
    @ryanwright3965 ปีที่แล้ว +3

    I love your videos. You are so thorough with the background information. Keep up the good work.

  • @pliniohavila
    @pliniohavila ปีที่แล้ว +1

    Very good. Very didactic, explains and writes very well.
    The good thing is that it not only presents the methods, but explains about them. Something that I almost don't see.
    Don't stop producing content.

  • @whitebeardpirates7551
    @whitebeardpirates7551 ปีที่แล้ว +1

    welcome backto uploading , i hope you'll upload more videos about Intermediate + Advanced nodejs. thanks I really really appreciate your effort ♥♥♥

  • @jackshephard7920
    @jackshephard7920 ปีที่แล้ว +1

    Amazing one! Looking forward to stream topic!

  • @randomcell708
    @randomcell708 ปีที่แล้ว +2

    Gold dust content, please keep going , too many youtubers leave subscribers high and dry by not finishing these kind of long running series.

  • @jsdepth
    @jsdepth ปีที่แล้ว +1

    Wow one More Nodejs core concept is now about to knock out.

  • @tharlinhtet97
    @tharlinhtet97 ปีที่แล้ว +1

    you are one of the best. pls come back with the amazing videos.

  • @omidsoleimani3817
    @omidsoleimani3817 ปีที่แล้ว

    OMG, I really learn from your videos, Looking forward to see streaming topic. Great Job.

  • @bicube7529
    @bicube7529 ปีที่แล้ว

    just finished also this video, awesome experience. really looking forward to the next 2

  • @talkArt
    @talkArt 11 หลายเดือนก่อน

    Absolute goldmine, thanks for sharing this, i have been learning node js rushing into express only to be back here to basics but this series is all i need.
    Would love to know if you would do this with next or express, specially with what is going on behind it.

  • @alonsob4069
    @alonsob4069 ปีที่แล้ว

    probably the best node course of all youtube

  • @akshayshah7008
    @akshayshah7008 ปีที่แล้ว +3

    Great lecture, give us some next topics which you are making video on, so that we can read the docs ourselves on that particular topic.

  • @brahimtaifour6849
    @brahimtaifour6849 ปีที่แล้ว +1

    hi there, I just watched your video and i want to thank you for your time and effort, you have a really nice way of explaining stuff and I hope that you will make more videos , my best wishes for you

  • @shujamigo
    @shujamigo ปีที่แล้ว +1

    brilliantly explained. thanks

  • @_ademmeral
    @_ademmeral 11 หลายเดือนก่อน

    Incredibly awesome tutorials. I wouldn't have such education there if I even participated in a bootcamp

  • @mohamedmirghani1747
    @mohamedmirghani1747 ปีที่แล้ว

    As usual amazing explanation, many thanks

  • @ahsanamin3818
    @ahsanamin3818 10 หลายเดือนก่อน

    Thank you so much brother. this playlist is really helpful for us. Please continue. upload more useful content.

  • @moneyharry
    @moneyharry 11 หลายเดือนก่อน

    Thank you very much for these wonderful lessons.

  • @karlluthor6628
    @karlluthor6628 ปีที่แล้ว

    U r the best 🎉
    Can’t wait to see the streams video

  • @hariprasath9985
    @hariprasath9985 ปีที่แล้ว +1

    Finally you made it

  • @serjio8781
    @serjio8781 10 หลายเดือนก่อน

    Love your videos man

  • @miggu
    @miggu 9 หลายเดือนก่อน

    I very much like that you go one or two levels below every explanation (but also know when not to digress) , in order to elucidate the description of a new concept

  • @jshvaron
    @jshvaron ปีที่แล้ว

    Thanks so much, this helped me a ton! subbed.

  • @xaapt
    @xaapt 10 หลายเดือนก่อน

    Wow! Method of teaching is the GOAT

  • @leoxvic4701
    @leoxvic4701 2 หลายเดือนก่อน

    Never stop making these gems! You are a gift to us

  • @georgigeorgiev3765
    @georgigeorgiev3765 ปีที่แล้ว +1

    Cheers man! You are amazing!

  • @moelf325
    @moelf325 ปีที่แล้ว +1

    Great job! You're indeed amzing! Thank you su much !!!

  • @sagarghare9829
    @sagarghare9829 8 หลายเดือนก่อน

    Completed. Thanks for tutotial :)

  • @SimPwear84
    @SimPwear84 3 หลายเดือนก่อน

    This is a Node JS Master Class - top quality content 🔥

  • @hamidhamri5384
    @hamidhamri5384 ปีที่แล้ว

    high quality content

  • @Netpilation
    @Netpilation 7 หลายเดือนก่อน

    life changing videos

  • @giotevdorashvili
    @giotevdorashvili ปีที่แล้ว

    I wish the video about Streams were already here, thanks.

  • @CarlJdP
    @CarlJdP หลายเดือนก่อน

    45:00 Re: vscode double saves: it depends on your vscode autosave settings, e.g. my autosave is set to onTabFocuschange (or something like that) - it depends on ones personal preference, but i like that it autosaves when i for example switch focus to the terminal or anther tab, so that i dont get frustrating bugs of where there's one tab i forgot to save

  • @new_avangard
    @new_avangard ปีที่แล้ว +1

    Thank you bro!

  • @muhammed7457
    @muhammed7457 ปีที่แล้ว

    Thank you man🖤

  • @yogeshkhatri4555
    @yogeshkhatri4555 ปีที่แล้ว

    great content!

  • @Js-Lovers
    @Js-Lovers ปีที่แล้ว

    Need more concept of nodejs 💕💓

  • @gabrielmachado5391
    @gabrielmachado5391 ปีที่แล้ว

    Thank you!

  • @jritzeku
    @jritzeku ปีที่แล้ว

    This series is EXTREMELY helpful! Thank you for your contribution. I would also like to learn about linux in a little more in depth but as it pertains to software engineers. Any good resources??

  • @FilipeCruz-rj8bb
    @FilipeCruz-rj8bb ปีที่แล้ว

    Subscribed and following!

  • @muhammedcansoy1434
    @muhammedcansoy1434 ปีที่แล้ว

    Awesome

  • @muhammedcansoy6131
    @muhammedcansoy6131 ปีที่แล้ว

    awesome

  • @shahariarhriday8966
    @shahariarhriday8966 ปีที่แล้ว

    Hello,
    I am not finding your nodejs streaming core video. Could you please share that one?

  • @susanthawarnapura
    @susanthawarnapura ปีที่แล้ว +2

    waiting for node streams video

  • @rajkirankelangi5751
    @rajkirankelangi5751 ปีที่แล้ว

    please make more videos in node series and express,mysql,mongodb ..please

  • @dreamcoreamv7091
    @dreamcoreamv7091 10 หลายเดือนก่อน +1

    The "3" triggered me

  • @themouldyorange2912
    @themouldyorange2912 ปีที่แล้ว

    so this app will only create plain/text file types because you are using fs.open() method? if you want to create a python file type or any other type you would need to use another method, is that right? i was confused as to why the files created were not showing the correct type in explorer and that is the only answer i have been able to find.

  • @jameshansen801
    @jameshansen801 ปีที่แล้ว

    When I use the createFile function, while it's returning the file, for some reason in VS Code it's appearing "empty" or as if it's not able to recognize its type; in a similar fashion as if you were to create an untitled file. When I go an attempt to rename that file, I always get the error that there's no file at that path to rename. I even tried playing around with the flags to see if anything changes, but to no avail. Do you have any idea what might be causing this? If it helps at all, I'm using Pop os.

    • @jameshansen801
      @jameshansen801 ปีที่แล้ว

      UPDATE: For the time being, I believe I solved the issue. Upon further investigation, I noticed that still for some reason, Node is adding a newline character at the end of the file path. I still can't figure that out but, for example if I use the trim function like this: createFile(filePath.trim()); it seems to alleviate the problem.

  • @dorelbarbu9453
    @dorelbarbu9453 ปีที่แล้ว +1

    Hello! At 01:03:10 I didn't get the exact reason why the returned buffer has 0s in it. I have the below snippet:
    const size = (await commandFileHandler.stat()).size;
    const content = await commandFileHandler.read(Buffer.alloc(size));
    Why is the position of the file modified here? Even if we don't specify offset and position it should in theory read from the beginning of the file.
    The below snippet behaves correctly, and reads from the beginning, so I don't understand why explicitly specifying the buffer in which we read makes it in such a way that we need to also specify the offset and position.
    const size = (await commandFileHandler.stat()).size;
    const content = await commandFileHandler.read();
    You explained in the video that it is because the position changed, but why did it change exactly? Is this some behavior that is documented and that I am missing?
    Would you be able to help me understand this, please?
    And as always, thank you for the very high-quality content!

  • @ujjawalkumar5707
    @ujjawalkumar5707 ปีที่แล้ว

    The content is exceptional.
    I have one question: why you have attached event to commantFileHandler? we can make a function call instead. please someone explain the advantages of attaching event in this scenario.

    • @Cododev
      @Cododev  ปีที่แล้ว

      Hi! Thanks for your question. Actually it’s just to make the code look a bit cleaner. We can also do it with a function call which is totally fine. And in my video Understanding Events, I explained that when we add an event listener and emit an event, we’re just calling a function and that’s it (please refer to that video if it doesn’t make sense). So in short, just for readability purposes!

  • @LekkyDev
    @LekkyDev 3 หลายเดือนก่อน

    @1:10 Property 'on' does not exist on commandFileHandler!
    How do you deal with that?

  • @stodani
    @stodani ปีที่แล้ว

    según me enseñaron siempre deberia evitar la alternativa sincrona (readFileSync) porque eso bloquearia y detendria el proceso principal (en caso de que mi app fuera mas larga y compleja) 🤔

  • @aliadel1723
    @aliadel1723 ปีที่แล้ว

    please do more videos

  • @Tommyharty_
    @Tommyharty_ ปีที่แล้ว

    1:10:00

  • @SHROUDICH
    @SHROUDICH 11 หลายเดือนก่อน

    Hello, you've mentioned that using synchronous fs method is not best way to do it because it freezes processes, doesn't Promise/await do the same thing, it also stops everything till it finishes.

    • @eyriusbacterius
      @eyriusbacterius 11 หลายเดือนก่อน

      as i understand it promises are handled asynchronously with async / await. it looks like synchronous code but it is asynchronous code. so no - it doesnt stop everything till it finishes

  • @codyshaner3258
    @codyshaner3258 ปีที่แล้ว

    Did they remove the watch method from 'fs/promises'
    I only see it in 'fs' but its not available from 'fs.promises'
    When I try and run the exercise from 41:20 - i get the error :
    TypeError: fs.watch is not a function
    If I change the import from 'fs/promises' to 'fs' and run it - i get the error :
    TypeError: watcher is not async iterable
    When I log the import for 'fs/promises' I don't even see '.watch' as a member.
    Am I missing a step or has this changed in the past year?

    • @Cododev
      @Cododev  ปีที่แล้ว +1

      Hmm I doubt that it’s changed Cody, what version of Node are you using?
      Also if you can show me your code I’d be able to see if you are missing something, thanks!

    • @codyshaner3258
      @codyshaner3258 ปีที่แล้ว

      @@Cododev Ahh good call, seems I was using node 14. I switched to 18 and it's good to go

  • @indicgamer2907
    @indicgamer2907 ปีที่แล้ว

    1:05:27 im still getting some buffers of zero length pls help

  • @danko5678
    @danko5678 ปีที่แล้ว

    To make the watch function work correctly, I used the function from cb API with debounce trick:
    let fsTimeout;
    watch("./command.txt", (event) => {
    if (!fsTimeout) {
    console.log(event);
    if (event === "change") {
    commandFileHandler.emit("change");
    }
    fsTimeout = setTimeout(() => {
    fsTimeout = null;
    }, 1000);
    }
    });
    Haha, event as a string, took 20 minutes to figure out what i was doing wrong. Actually I have a realy realy good question: why this code doesn't work correctly without "console.log(event);" ?

  • @user-iq1km3bd9s
    @user-iq1km3bd9s ปีที่แล้ว +1

    Run fast the cops are coming for you :)))

  • @rayforever
    @rayforever หลายเดือนก่อน

    39:04 this is why I hate JS

  • @abdullahsiam7609
    @abdullahsiam7609 11 หลายเดือนก่อน

    just 3 min of video. I stopped and subscribe.

  • @igboanugwocollins4452
    @igboanugwocollins4452 ปีที่แล้ว

    Awesome awesome video, thank you so much! 👏

  • @abdulwadood-np4kb
    @abdulwadood-np4kb 10 หลายเดือนก่อน

    🔥@Codedev