Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • FSWatcher

Implements

  • FSWatcher

Index

Constructors

Properties

Methods

  • add(paths: string | readonly string[]): FSWatcher
  • Add files, directories, or glob patterns for tracking. Takes an array of strings or just one string.

    Parameters

    • paths: string | readonly string[]

    Returns FSWatcher

  • close(): Promise<void>
  • Removes all listeners from watched files.

    Returns Promise<void>

  • getWatched(): {}
  • Returns an object representing all the paths on the file system being watched by this FSWatcher instance. The object's keys are all the directories (using absolute paths unless the cwd option was used), and the values are arrays of the names of the items contained in each directory.

    Returns {}

    • [directory: string]: string[]
  • on(event: "add" | "addDir" | "change", listener: (path: string, stats?: Stats) => void): FSWatcher
  • on(event: "all", listener: (eventName: "add" | "addDir" | "change" | "unlink" | "unlinkDir", path: string, stats?: Stats) => void): FSWatcher
  • on(event: "error", listener: (error: Error) => void): FSWatcher
  • on(event: "raw", listener: (eventName: string, path: string, details: any) => void): FSWatcher
  • on(event: "ready", listener: () => void): FSWatcher
  • on(event: "unlink" | "unlinkDir", listener: (path: string) => void): FSWatcher
  • on(event: string, listener: (...args: any[]) => void): FSWatcher
  • Parameters

    • event: "add" | "addDir" | "change"
    • listener: (path: string, stats?: Stats) => void
        • (path: string, stats?: Stats): void
        • Parameters

          • path: string
          • Optional stats: Stats

          Returns void

    Returns FSWatcher

  • Parameters

    • event: "all"
    • listener: (eventName: "add" | "addDir" | "change" | "unlink" | "unlinkDir", path: string, stats?: Stats) => void
        • (eventName: "add" | "addDir" | "change" | "unlink" | "unlinkDir", path: string, stats?: Stats): void
        • Parameters

          • eventName: "add" | "addDir" | "change" | "unlink" | "unlinkDir"
          • path: string
          • Optional stats: Stats

          Returns void

    Returns FSWatcher

  • Error occurred

    Parameters

    • event: "error"
    • listener: (error: Error) => void
        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    Returns FSWatcher

  • Exposes the native Node fs.FSWatcher events

    Parameters

    • event: "raw"
    • listener: (eventName: string, path: string, details: any) => void
        • (eventName: string, path: string, details: any): void
        • Parameters

          • eventName: string
          • path: string
          • details: any

          Returns void

    Returns FSWatcher

  • Fires when the initial scan is complete

    Parameters

    • event: "ready"
    • listener: () => void
        • (): void
        • Returns void

    Returns FSWatcher

  • Parameters

    • event: "unlink" | "unlinkDir"
    • listener: (path: string) => void
        • (path: string): void
        • Parameters

          • path: string

          Returns void

    Returns FSWatcher

  • Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns FSWatcher

  • unwatch(paths: string | readonly string[]): FSWatcher
  • Stop watching files, directories, or glob patterns. Takes an array of strings or just one string.

    Parameters

    • paths: string | readonly string[]

    Returns FSWatcher