I want to check a file exist in folder. Below code is while i\'m trying to many times is not working.
As I learned years ago you cannot access local file system with JS from browser, but things change. You can find more info here:
Local file access with javascript
The article directs you to MDN but the solution works only in certain browsers:
https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API
You can't access local files in modern web browsers. There is the HTML5 File API, but that involves direct user actions, you can't just use whatever files you please.
There is no way you cant access files using your browser , JavaScript is a view language its interact only with the browser, to be able to access local file you need to use a back end platform such as NodeJs or Php
This wont work because your browser does not have access to your file system.
you can run this from a node.js server
see https://en.wikipedia.org/wiki/JavaScript#Security