• Version 0.7.4
  • Published
  • 26.1 kB
  • No dependencies
  • MIT license


npm i node-watch
yarn add node-watch
pnpm add node-watch


A wrapper and enhancements for



function watch

watch: {
(pathName: PathName): Watcher;
(pathName: PathName, options: Options): Watcher;
(pathName: PathName, callback: Callback): Watcher;
(pathName: PathName, options: Options, callback: Callback): Watcher;
  • Watch for changes on filename, where filename is either a file or a directory. The second argument is optional.

    If options is provided as a string, it specifies the encoding. Otherwise options should be passed as an object.

    The listener callback gets two arguments, (eventType, filePath), which is the same with eventType is either update or remove, filePath is the name of the file which triggered the event.

    Parameter filename

    File or directory to watch.

    Parameter options

    Parameter callback


interface Watcher

interface Watcher extends FSWatcher {}

    method getWatchedPaths

    getWatchedPaths: () => Array<string>;
    • Returns all watched paths.

    method isClosed

    isClosed: () => boolean;
    • Returns true if the watcher has been closed.

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (2)

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this badgeto your package's README, use the codes available below.

    You may also use to create a custom badge linking to

    • Markdown
    • HTML
      <a href=""><img src="" alt=""></a>