Skip to content

ExternalFileMonitor

Unofficial

Watches one external file without retaining the file object.

Import:

import type { ExternalFileMonitor } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ExternalFileMonitor

Properties

PropertyTypeDescription
filenull | TExternalFileThe current file, or null after its weak reference expires.
filerefWeakRef<TExternalFile>Weak reference to the file.
inodenumberLast observed inode, used to restart monitoring on non-Windows platforms.
managerExternalFileManagerThe owning manager.
watcherFSWatcher | nullActive filesystem watcher, or null when stopped.
watchpathstringPhysical path currently being watched, or an empty string when stopped.

Methods

MethodReturnsDescription
isWatching()booleanChecks whether monitoring is active.
onFileChanged()Promise<void>Refreshes file statistics, clears stale caches and emits modify or delete events.
start(stat?)voidStarts monitoring if the file still exists and can be watched.
stop()voidStops monitoring and resets the watched path and inode.

Links to this page: