0.3.5 • Published 5 months ago

@ms-cloudpack/file-watcher v0.3.5

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

@ms-cloudpack/file-watcher

An abstraction on the file watching capabilities used in Cloudpack.

Example usage

  1. Create a watcher:
const watcher = createWatcher();
  1. Subscribe to a particular package path using watch. (Returns an unwatch function.)
const unwatch = watcher.watch({ path: 'path/to/package' }, () => console.log(`package changed`));
  1. To dispose, call the returned unwatch, or call watcher.dispose to unsubscribe from all watchers.
// Dispose an individual watcher.
await unwatch();

// Dispose all watchers.
await watcher.dispose();

createWatcher options

  • type ('default' | 'fork', optional): By default, this will create a watcher in the same thread. Use type: 'fork' to create the watcher in a forked process.

watcher.watch options

  • path (string): The absolute root path to be watched.
  • id (string, optional): ID for the watch job (defaults to path). If you call watch twice using the same id, subsequent calls will be ignored.
  • watchedPaths (string[], optional): Relative paths/globs from the root path to watch. Defaults are under "@ms-cloudpack/path-utilities" in sourceFilesGlobs.
0.3.0

6 months ago

0.2.0

9 months ago

0.3.5

5 months ago

0.3.2

5 months ago

0.1.4

10 months ago

0.3.1

5 months ago

0.1.3

11 months ago

0.3.4

5 months ago

0.3.3

5 months ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago