watch-file-safe
Version:
Watch a file for changes
13 lines (12 loc) • 432 B
TypeScript
export declare type EventCallback = (path: string) => void;
export declare type Watcher = {
onAdd: (cb: EventCallback) => Watcher;
onRemove: (cb: EventCallback) => Watcher;
onChange: (cb: EventCallback) => Watcher;
onReady: (cb: () => void) => Watcher;
/**
* Return `true` on success, `false` on errors.
*/
stop: () => Promise<boolean>;
};
export default function watchFile(path: string): Watcher;