Problem Statement
Here is a problem I want to solve…
One of the biggest power of Obsidian is that is Open Access. That means, any external application or service can modify the content from the Vault the way they want and at anytime. Especially, when Obsidian is not active (on desktop or mobile), there is no way for plugins to know which files had been updated between the time when Obsidian was closed and re-opened again.
For example, yesterday I closed Obsidian at 10pm and today opened it again at 11am. Between this time, I used another application to edit some of the files from the vault. Or there was an external synching service which updated some of the files.
Now, as a plugin, if I want to find out which all files had been modified between this time. The only approach I have is to iterate over all the files from the vault => Get their last modified time => And check whether this time falls between this window (from 10pm to 11 am). I havent implemented this yet, so not sure how much resource consuming process this would be. But surely sounds like its going to take some time if there are thousands of files in the vault. (Also, as per my google searching, I dont think there are any APIs provided by the file system itself to fetch all the files by sorting them in a modified-time criteria and then getting the top files which were modified after a particular time).
Possible Solution
What I am requesting here from the Obsidian is…
If I am correct Obsidian is running a indexing mechanism when it boots up. Now, I feel its running it over all the files within the vault. Because bigger the vault, its takes longer to index.
If thats true, can Obsidian provide an API, where a plugin can call this API and will return all the files which were modified after the Obsidian application was closed last time.
The next step would be to pass the last modified time and get all the files modified after that. But this is really optional and the basic functionality which will really going to help is to be able to get all the files which were modified after the application was closed last time. As a plugin doing this indexing whenever the plugin loads seems really unnecessary as Obsidian has already done that.
I am all ears to learn more about whatever the community has to share, whether my assumption on Obsidian indexing is correct and is there a better approach to achieve this.