obsidian/metadata-cache
This module provides utility functions for working with the metadata cache in Obsidian.
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| CachedMetadataEx | An extended CachedMetadata that records which parsing CachedMetadataExFeatures were applied (via CachedMetadataEx.features) and carries the resulting external links. Each links array is populated only when its corresponding feature is present in CachedMetadataEx.features. |
| GetBacklinksForFileSafeOptions | Options for getBacklinksForFileSafe. |
| GetBacklinksForFileSafeParams | Parameters for getBacklinksForFileSafe. |
| GetBacklinksForFileSafeWrapper | Wrapper for the getBacklinksForFile method that provides a safe overload. |
| GetLinksParams | Params for getLinks. |
| ParseCacheOptions | Options for the parsing performed by getCacheSafe and parseMetadata beyond Obsidian’s native metadata parsing. Each option is opt-in; enabling it adds the corresponding CachedMetadataExFeature and populates the matching links array. |
| RegisterFileCacheForNonExistingFileParams | Parameters for registerFileCacheForNonExistingFile. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| ensureMetadataCacheReady | Ensures that the metadata cache is ready for all files. |
| getBacklinksForFileOrPath | Retrieves the backlinks for a file or path. NOTE: The file may be non-existent. |
| getBacklinksForFileSafe | Retrieves the backlinks for a file safely. |
| getCacheSafe | Retrieves the cached metadata for a given file or path. |
| getFrontmatterSafe | Retrieves the front matter from the metadata cache safely. |
| getLinks | Retrieves the selected links from the provided cache. |
| isCachedMetadataEx | Determines whether a cache is a CachedMetadataEx (i.e. it was computed with external-link parsing enabled). |
| parseMetadata | Parses the metadata for a given string. |
| registerFileCacheForNonExistingFile | Registers the file cache for a non-existing file. |
| registerFiles | Registers files in the Obsidian app. |
| unregisterFileCacheForNonExistingFile | Unregisters the file cache for a non-existing file. |
| unregisterFiles | Unregisters files from the Obsidian app. |
| Type | Description |
|---|---|
| GetCacheSafeOptions | Options for getCacheSafe. |
| ParseMetadataOptions | Options for parseMetadata. |
| Enum | Description |
|---|---|
| CachedMetadataExFeature | A parsing feature that was applied when computing a CachedMetadataEx. |