import Watcher from "./watcher/Watcher"; import { WatchOptions } from "./docs/docs"; export type { WatchOptions, OnWatchedDataUpdateHandler, onWatchedDataRemoveHandler, onWatchedDataRenameHandler, onWatchedDataAddHandler, WatchedDataChangeEvent, onWatchedDataChangeHandler, RenameEvent, UpdateEvent, RemoveEvent, AddEvent, ChangeEvent, WatchedFile, WatchedFolder, WatchedData } from './docs/docs'; export { Watcher } from "./watcher/Watcher"; declare class Overwatch { #private; constructor(); /** * Registers a watcher for the specified path, which can be a file or directory. * * @param path_ - The absolute or relative path to the file or directory to watch. * The path will be resolved and normalized before being tracked. * @param options - Optional configuration options for the watcher. * If watching a directory, you can specify filters to include or exclude specific paths. * @returns A `Watcher` instance for the specified path. * @throws Will throw an error if the path does not exist or cannot be resolved. */ watch(path_: string, options?: WatchOptions): Promise; /** * Registers a watcher for the specified file path. * * @param path_ - The absolute or relative path to the file to watch. * The path will be resolved and normalized before being tracked. * @param options - Optional configuration options excluding `exclude` and `include` filters. * These filters are irrelevant since a file is not a directory. * @returns A `Watcher` instance for the specified file. * @throws Will throw an error if the path does not exist or cannot be resolved. */ watchFile(path_: string, options?: Exclude): Promise; /** * Registers a watcher for the specified directory path. * * @param path_ - The absolute or relative path to the directory to watch. * The path will be resolved and normalized before being tracked. * @param options - Optional configuration options including filters to restrict which files and folders are watched. * @returns A `Watcher` instance for the specified directory. * @throws Will throw an error if the path does not exist or cannot be resolved. */ watchFolder(path_: string, options?: WatchOptions): Promise; /** * Gets the current detection interval in milliseconds. * * This value determines how frequently the file system is scanned * for changes across all watched paths. * * @returns The current detection interval in milliseconds. */ get detectionInterval(): number; /** * Sets the detection interval in milliseconds. * * This controls how often Overwatch checks the file system for changes. * A lower interval results in faster detection but higher CPU usage. * * @param interval - The interval in milliseconds (minimum: 200ms). * @throws {TypeError} If the provided value is not a finite number. * @throws {RangeError} If the value is below 200 milliseconds. */ set detectionInterval(interval: number); /** * Provides runtime control over the internal scanning engine. * * Use this property to pause or resume the file system scanning engine manually, * without removing or altering existing watchers. This is useful for temporarily * reducing resource usage during periods when file monitoring is not needed. * * Example: * ```ts * overwatch.control.pause(); // Temporarily stop scanning * overwatch.control.resume(); // Resume scanning * console.log(overwatch.control.isRunning()); // Check engine state * ``` * * This property is read-only and exposes the following methods: * - `pause()` – Stops the internal scanning engine. * - `resume()` – Starts or resumes scanning. * - `isRunning()` – Returns a boolean indicating whether scanning is active. */ readonly control: Readonly<{ /** * Starts or resumes the internal scanning engine. * * This method triggers the engine responsible for detecting changes to all watched paths. * If the engine is already running, calling this again has no effect. * * Use this to resume file system monitoring after calling `pause()`. * @since v1.1.0 */ resume: () => void; /** * Temporarily pauses the internal scanning engine. * * While paused, the system will not scan for changes or emit any file system events. * Existing watchers remain intact and will resume functioning once `resume()` is called. * * Useful for temporarily reducing I/O load without removing watchers. * @since v1.1.0 */ pause: () => void; /** * Indicates whether the scanning engine is currently active. * * @returns `true` if the engine is currently scanning for changes, * `false` if it has been paused via `pause()`. * * You can use this to programmatically check the system state before pausing or resuming. * @since v1.1.0 */ isRunning: () => boolean; }>; } declare const overwatch: Overwatch; export default overwatch;