Hey ninjas, in this node js tutorial for beginners, I’ll introduce you to pipes, and how we can use them to pipe a readable stream into a writable stream.

+ Repo –
+ Atom editor –

You can find more front-end development tutorials on CSS, HTML, JavaScript, jQuery, WordPress & more on the channel homepage…


========== JavaScript for Beginners Playlist ==========

============ CSS for Beginners Playlist =============

============== The Net Ninja =====================

For more front-end development tutorials & to black-belt your coding skills, head over to – or

================== Social Links ==================

Twitter – @TheNetNinja –


  1. One thing which i dont get it is why do we have to move "myReadStream" variable to server function ? Once we define it we should be able to access it from any function and i tried it HOWEVER If we leave "myReadStream" variable OUTSIDE server function and we make a request we do get the contents from the text file as we should but if i update file content, save the file and then try to refresh the page i get blank page ? Why is that ? If i then move reamStream varialbe to the server function block i get contents even when the node app is running and i update file contents. Why we always get content from the file variable if its in server block but receive nothing if file is updated and the variable is outside server block ?

  2. One thing that confused me at first when I discovered the stream world of NodeJS is that some apps were streaming anything. In fact I think NodeJS developers like to use streams syntax to stream anything. With use of libraries you can stream pretty much everything. You can stream a file, a set of files, directories, functions' results IN another file, directory, function. That's what confused me, but streams are good because you don't really care what happens behind the tool you use, the library is just telling you "you can pipe a in b" and you just use it and it works.

  3. what if we have to emit some action after reading stream like previous method but this time using pipes.. Please answer me….

  4. Thank you for the video. I have a question if my web site has more than one page then how will i navigate them, i tried calling it again in app.js file but not redirecting to the paticular tag. Can you please tell how do we use "NAV TAG" basically.

  5. Excuse me sir, I got a problem when I try do "myReadStream.pipe(res);" and use the same port as I used before , port 3000. but when I use port 4000 It work fine. thank you

  6. Why is it better for performance, the response to the client is one block of text anyways, it does not receive texts as it gets read by the server… can anyone explain?

  7. Question: if you were to update the 'readMe.txt' while someone was on the url, would it automatically appear on their page without them refreshing?

    Great series BTW, just started Node JS and already like it better than php

  8. I really appreciate your effort to make this series of tutorials. But this is absolutely confusing for me.
    I don't see any purpose of using this streams, buffers, pipes etc… I don't say that is no purpose in general.
    For me this is just a writing data from one file to other, like using 'fs' module.
    I'll continue to watch this session, but just want to write me honest opinion about this videos.


  9. you are just awesome sir 🙂 and your ascent is something i love to adopt :).
    best thing is, you are not just hurrying up.
    i have been watching your tutorial from start a question is will you b creating Rest Full api's ?


  10. You know what I really like about your tutorials? You explain things that other tutorials tend to gloss over. I mean, pipes, read and write streams, I never would have known if wasn't for you. =) Thank you Net Ninja! You are a programming hero!


Please enter your comment!
Please enter your name here