I'm trying to update a page of mine which currently does not have a way to refresh the version number that is read from a file because the page is only generated once by a Python script. I decided to convert the page to a static page rather than a generated one and try to just read the information using JavaScript. The problem is that two of the files I need to read are /proc/cpuinfo and /proc/device-tree/model. The files are server-side.
I can't seem to find any information on using FileReader
with just a file path, and it seems to rely on the "file" input to provide a File
object. I looked into using XMLHttpRequest
, but would that even be able to read a file that is not under /var/www?
The reason the Python script was able to read the files is because it is a cgi script and has sudo permissions.
Do I have any options to do this with a static HTML page? Or will I need to keep the page generator script since those two files live outside the /var/www directory?