Hello again everyone,

Today, I was exploring the FileSystem library of nodeJs and I would like to share about difference between two methods I was studying.
We already know about a function fs.open(FileName,Mode,Callback), allow us to open the file and it also allow us to do whatever we want to do with the file like writting etc. where as on the other hand fs.openSync(FileName, Mode), only allows you to open the file in particular format you are looking in. This is because it is a synchronous method and it helps to code one after other. fs.openSync() will not allow you to do anything which we were able to do in fs.open() through its callback.
And also fs.Open() does not return anything whereas fs.openSync() returns the file descriptor for the identification of the file.
Thank you,
That's it for today!!!

Comments

Popular posts from this blog