notthehoff
notthehoff

Reputation: 1242

Is there a way to listen for non-saved changes of a file?

Currently, I am using the ruby Listen gem that listens for file saves in an ongoing manner and then my application can reacts accordingly after a file is saved. What I would like to do is be able to be updated if a user is updating a file, but not rely on save to get that information.

The use case would be that User X opens a .txt file (which I have predefined) and starts typing in it. With every cursor move, change, keystroke etc I can hear that something has changed and be able to know what the current contents of that .txt file are.

Any thoughts?

Upvotes: 0

Views: 35

Answers (1)

Uri Agassi
Uri Agassi

Reputation: 37409

Since most editors read the file to memory, and let the user edit it there, the file system has no idea whether any editor is currently editing any file in memory...

The only thing the file system 'knows' is when a file is read or written...

Upvotes: 2

Related Questions