#Watch for changes to txt file

6 messages · Page 1 of 1 (latest)

jade flicker
#

Is there some way I can check to see if a text file has changed with tauri fs?

#

Ideally using JS. I don't see anything in the fs doc for watch or anything like that.

random gulch
#

Not a solution but I remember a while back I had to do something similar with js and I asked on some forums and basically there are two approaches, you can either checksum the file and compare it and do that on a loop (with some timeout) believe it or not it's actually used as bad as it sounds

The better approach is to use a native system module to do that, this differs from os to os and you'll need to implement it for each os you're supporting, I am not even sure it's supported everywhere but iirc I was on windows at the tome and it was possible I don't remember how though

jade flicker
#

Yeah, I'm being pretty janky right now. I'm just checking it every second. But, I'm hoping to to find a better way. I really only need to target Windows in this case.

brittle glacier
#

You could either check every N milliseconds if the file has changed by checking if its metadata has changed since last time it scanned it

Or you can set up watching with Rust

restive stratus