I would like a way of doing this:
It needs to run in the browser.
(This is not a duplicate of How do I open a file stream in javascript?; that question is over 5 years old and the file APIs have changed a lot since then. Also, it doesn't keep the file open.)
I dont think you can open a file w/o re-prompting the user unless your code is privileged in the browser (like a browser extension). I have found an api that let you do exactly what you want. but you need privileges to use it.