I'm making a file manager using NodeJS and EJS, I have a default /folders
route which reads all files and folders in a specific location using fs.readdirSync(folderPath, { withFileTypes: true });
and another route /create-folder
makes me a new folder using fs.mkdirSync(folderPath, {recursive:true});
the thing is while the changes are reflected on the actual OS's file system instantly - the folder & files are created successfully - it doesn't show on the web app using the mentioned fs.readdirSync()
in the /folders
route, I need to restart the application to be able to see them, and since it's a file manager I need to see my created files & folders immediately, is it a caching issue, and if so how can I disable it?