Function watchFile

  • Watch for changes on a file. The callback listener will be called each time the file is accessed.

    The options argument may be omitted. If provided, it should be an object with a persistent boolean and an interval number specifying the polling interval in milliseconds.

    When a change is detected, the listener callback is called with the current and previous Stats objects.

    Parameters

    • path: PathLike

      The path to the file to watch.

    • listener: ((curr, prev) => void)

      The callback listener to be called when the file changes.

        • (curr, prev): void
        • Parameters

          Returns void

    Returns void

  • Parameters

    • path: PathLike
    • options: {
          interval?: number;
          persistent?: boolean;
      }
      • Optional interval?: number
      • Optional persistent?: boolean
    • listener: ((curr, prev) => void)
        • (curr, prev): void
        • Parameters

          Returns void

    Returns void