0.7.0 • Published 6 years ago

watch-and-sync v0.7.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

watch-and-sync

A script to watch a directory on your local machine and copy it to a remote when changes are detected

Usage

npx watch-and-sync --help

Notes and observations

The script uses Node's fs.watch API to handle the directory watching. There are a few third-party packages that do similar things that I considered but chose not too as I didn't encounter the problems they claim to solve.

chokidar, for example, claims that fs.watch:

  • Doesn't report filenames on OS X
  • Doesn't report events at all when using editors like Sublime on OS X
  • Does not provide an easy way to recursively watch file trees
  • Often reports events twice

I tested the first three points and found that they simply aren't the case; I assume they were problems that have since been fixed in later versions of Node.js. I did observe fs.watch reporting events twice (see debounce below).

Dependencies

rsync

  • Widely-used and stable
  • Used to do the actual syncing between local and remote
  • Script assumes the executable is present in your PATH

debounce

  • npm package
  • fs.watch seems to often get called twice for the same file change
    • Not sure on the cause - initial investigation seems to point to it coming from the underlying FSEvents API
0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago