node-watch

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

Install

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

Overview

A wrapper and enhancements for fs.watch

Index

Functions

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 fs.watch. 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

Interfaces

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.

    Badge

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

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/node-watch.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/node-watch)
    • HTML
      <a href="https://www.jsdocs.io/package/node-watch"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>