Keeping an eye on file uploads
What is the remote file watcher?
The remote file watcher was developed as a way to easily monitor multiple directories on multiple servers for new file uploads and the removal of files. It is extremely easy to use. Just provide an object of connection details for the server containing a group of directories to monitor and when a file is uploaded or delete an event is emitted. At the moment an SFTP connection is used only. More connection type support is planned for development.
Below is an example of how to instantiate the class, providing the config object, and listen for the 3 events that are currently emitted:
const remoteFileWatcher = ;var objConfig =host: '192.168.1.10'port: 22username: 'server_username'password: 'server_password'algorithms:serverHostKey: 'ssh-rsa' 'ssh-dss'folders :0 : '/var/www/html/DirectoryOne'1 : '/Uploads/DirectoryTwo'//debug: console.logconst objRemoteFileWatcher = 'my_server_name' objConfig;objRemoteFileWatcher;objRemoteFileWatcher;objRemoteFileWatcher;objRemoteFileWatcher;