I’m working on a package that stores metadata for project files in a local database. I’ve been trying to construct a method for checking whether or not the database needs to be updated, even if the changes to those files occurred outside of Atom. The obvious choice is to save the file digest, and check it against the digest when the file is loaded again.
I’m not sure if it’s me, a bug, or intentionally impossible, but once I’ve loaded a file into atom, it seems to cache the file digest and will not update it when I save changes to the file. As soon as I reload, I get the new digest, but I can’t seem to find a way to access that new digest after a save, so that I can update the database. I’ve tried readSync() and getDigestSync() after the save, and they return the cached digest from before any changes were made.
The impact of this is that I can’t save any changes to the files in the database, unless I save them with an invalid digest, which will trigger a database update the next time I reload. I can link all the metadata to the file path as an alternative, but then if the file changes outside of Atom, the database will not know to update the file (it’s simple enough to capture the changes made from Atom).