Monday 30 July 2018

How to detect if file is being written to

Trying to find a solid solution to detect if large files are being written to by another program/user. I have a method that works, but is potentially error prone (putting a fs.renameSync(file, file) function in a try/catch). Placing a file size check in a timeout will return inconsistent results as apps all write to files in different intervals, also slows down quite a bit when processing lots of files. Also lsof command won't work in this scenario cause I'm accessing network files that could be written to by other computers. Let me know if you guys have any ideas for this. Thanks!

Submitted July 30, 2018 at 05:49PM by justin2taylor

No comments:

Post a Comment