function watch
watch(
path: string | URL,
options?: WatchOptions,
): Stream<FsEvent, WatchError>

Watches path for file-system changes, yielding a FsEvent for each.

Uses a push-based queue internally so events are never dropped between yields. Cancel the stream to stop watching (e.g. via take, breaking for await, or returning from the generator).

Note: on some platforms rename events cannot distinguish creation from deletion without a stat check. This implementation infers the kind by checking whether the file still exists at event time.

Parameters

path: string | URL
optional
options: WatchOptions

Return Type

Usage

import { watch } from ".";