Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
How to Send Files in Express JS | Fix __dirname Not Working in Express JS
Play lesson

Node JS Tutorial for Beginners in Hindi - 2025 - How to Send Files in Express JS | Fix __dirname Not Working in Express JS

5.0 (2)
26 learners

What you'll learn

This course includes

  • 35.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

In this video, we dive into fixing the common issue of __dirname and __filename not working in Express JS (ESM). Learn how to properly structure your project, get the actual file path, and use sendFile to serve files. By the end, you’ll be able to confidently send files in Express without errors. Perfect for beginners and intermediate Node.js developers! 💸 Get All My YouTube Videos' Source Code for just ₹249! Grab Now - https://thapatechnical.shop/source-code 📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup 🔥 Access Source Code, PPT & Notes here for Free : https://www.thapatechnical.com/2024/11/introduction-to-nodejs.html ------------------------------------------------------------------------ 🚀 Boost Your Skills with these Pre-Requisite Videos: 🔗 Best HTML Course - https://youtu.be/5ccq_nLHneE 🔗 Best CSS Course - https://youtu.be/MSICFljRcb4 🔗 JavaScript Basics Course Part 1 - https://youtu.be/13gLB6hDHR8 🔗 JavaScript Advanced Course Part 2 - https://youtu.be/YwsOCN8woA8 ------------------------------------------------------------------------ 💸 Build Your Own E-commerce Website for Free! - https://www.thapatechnical.com/2024/03/build-complete-ecommerce-website-using.html ------------------------------------------------------------------------ ✌️ Join Us! 🚀 Become a Member: Unlock perks, free source code, and more Join Now : https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA/join 📷 Connect on Instagram: https://www.instagram.com/thapatechnical 🗨️ Join Our Discord Server: Hang out with fellow programmers Discord Link: https://discord.gg/MdScmCsua6 ------------------------------------------------------------------------ ⌛TIMELINE⏳ 0:00 Introduction to sendFile in Express JS 0:25 Setting Up the Folder Structure 1:20 Why __dirname and __filename Don’t Work in ESM 3:10 Alternative to __dirname in Express 5:00 Getting the Actual Pathname in Express JS 6:10 Sending Files in Express with sendFile 7:05 Proper Way to Use sendFile in Express JS 9:20 Outro and Final Tips

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

FAQs

Course Hive
Download CourseHive
Keep learning anywhere