node.js - Check if a file is open in another process -


is there way open file non-sharing exclusive read-write access?

a file change event fs.watch not mean file has been written, in case of node based processes more chunks coming down stream, or might not have been flushed yet.

fs.open lets file open , being streamed opened, in write mode without error. 1 introduce timeout delay that's brittle , arbitrary.

on windows, 1 able createfile file_share_none c, can't quite recall equivalent on linux (as locks advisory if remember correctly), don't know if os x has equivalent, posix or otherwise).

you can use @ronomon/opened check if file open in process, if applications have open handles or file descriptors file.

it won't tell applications have file open, file open in other applications.

it works on windows, macos , linux , requires privileges on linux.

it uses native binding on windows open file exclusive sharing mode detect sharing violations due other processes open handles.

on macos , linux wraps lsof.

compared using alternative such flock, far understand, flock advisory, work if processes cooperate check lock, not case of time if processes independent.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -