hello guys welcome to data hacks in this video I'm going to explain about how we are going to use FS promise module in previous video I have explained FS module if you want to learn I will provide the link in the top right corner so you will get the clear idea of what is FS module it will be helpful to learn this FS promise mod module here first comment all the codes and create constant FS require node colon FS pyph [Music] promises so after this first you are going to read the files as synchronously for that constant file content here [Music] FS read file so here I'm going to mention the path files text and the encoding is going to be UTF iy 8 dot then dot catch so here we are using then and catch so we don't need to create a variable and here I'm going to provide one Arrow function data console the data again I'm going to use Arrow function [Music] error console log error first format your documents open the terminal run node index so now you can see the value is showing here so to see the value here file. hello data hacks we are reading hello files one txt the value is hello data Hax consol here so to prove as synchronously it is working I'm going as I practice previously show the console here also I'm going to show same initial values and final values so final values clear the terminal run again initial value it has shown it is asynchronous so before consoling here it moved here conso the final values final values finally console the data and also we can use this in a asynchronous AWA function also to show how we can use this FS promise read file function commment to this one create a asynchronous function which is going to be read file read file so after this I'm going to provide try method and catch FS do read file copy this and paste it here create a constant data console do log data here console.log [Music] error and it is going to be a Str again I'm going to form the document here clear the terminal run again so here we didn't trigger the function so let's call the function here call the function here so clear run again you can see here so we miss our it here so clear again run you can see the values properly here so if you use this asynchronous function it will be helpful and it will be more readable to understand the code thank you for watching this video if it does help you please subscribe the YouTube channel get the updates on and