Reusable file-watching primitives for NetScript: composable strategies, filters, and a
pipeline-based FileWatcher for detecting file-system changes across local and network
filesystems. This page is generated from the package's public surface with deno doc
(US-2). For the full index of packages and plugins return to the
reference overview.
The package exposes a single root entrypoint (@netscript/watchers -> ./mod.ts). There are
no sub-path exports. The watcher auto-selects its strategy (native OS notifications for local
paths, polling for network paths) so most callers only need createWatcher; the strategy
classes themselves are internal implementation details.
function createWatcher(options: WatcherOptions): FileWatcher
Factory function to create a FileWatcher with the given options.
Watcher
Symbol
Kind
Member
Signature
Description
FileWatcher
class
constructor
new FileWatcher(options: WatcherOptions)
Composable file watcher that combines a strategy with a filter pipeline; auto-selects native vs. polling.
watch
async *watch(): AsyncGenerator<WatchEvent>
Start watching and yield file events through the filter pipeline.
stop
stop(): void
Stop the watcher by signaling abort.
running
get running(): boolean
Whether the watcher is currently running.
Filters
Filters consume an async iterable of events and yield only the events that pass. They run in
configured order inside the FileWatcher pipeline. Each implements the WatchFilter contract.
Symbol
Kind
Member
Signature
Description
GlobFilter
class
constructor
new GlobFilter(patterns: readonly string[])
Yields only events whose filenames match at least one glob pattern.
The concrete strategy classes (NativeStrategy, PollingStrategy, HybridStrategy) and their
option interfaces (NativeStrategyOptions, PollingStrategyOptions, HybridStrategyOptions)
are marked @internal. They are selected automatically by FileWatcher based on the configured
paths and are not part of the supported public contract -- construct watchers via createWatcher
or new FileWatcher(...) instead.