In the same directory on the server as the html page I have a log that comes from an application. I want to check this file exists and the size or modified date of this file.
This needs to be in a simple JavaScript function that looks for the file and confirms it exists and the size or time modified of the file.
This is so I can update or reload my html page if there is new data. The data itself is being transformed via xslt. Is there something like this I can do:
function checkForLog() {
let logFile = new File([""],"./report.log");
let size = logFile.size;
if (size > previousSize){
location.reload(true);
}
}
I tried this but it returns 0 even though the file report.log is 56kb so it seems this logFile is a new file instance and not actually a reference to my file in the directory.