Closed lishid closed 3 years ago
@lishid
Yep, didn't change it here, yet. Is there a way to quickly read the content of the file without reading the file itself? I'm afraid what accessing the file system for many files will be a little bit performance consuming.
The only way to do that is to use vault.cachedRead(file)
, which might still read the file from disk if it hasn't been read before.
That's the API we use for search, backlinks, etc, so it should have quite an overlap (i.e. reading most files) for your use case to be fast enough.
https://github.com/mrjackphil/obsidian-text-expand/blob/cab03f24bc269bbbb1e5441e6bc35259a2b22b3a/main.ts#L166
Please don't use
cachedData
. This is an internal API that is sometimes null or undefined.