1.0.6 • Published 7 years ago

remote-file-watcher v1.0.6

Weekly downloads
9
License
Apache-2.0
Repository
-
Last release
7 years ago

remote-file-watcher

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.

Example usage

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 = require('remote-file-watcher');
    
    var objConfig = {
        host: '192.168.1.10',
        port: 22,
        username: 'server_username',
        password: 'server_password',
        algorithms: {
            serverHostKey: [ 'ssh-rsa', 'ssh-dss' ],
        },
        folders : {
            0 : '/var/www/html/DirectoryOne',
            1 : '/Uploads/DirectoryTwo'
        },
        //debug: console.log
    }
    
    const objRemoteFileWatcher = new remoteFileWatcher('my_server_name', objConfig);
    
    objRemoteFileWatcher.on('uploading', function (objFile) {
    
        console.log('FILE UPLOADING:');
        console.log(objFile);
    });
    
    objRemoteFileWatcher.on('uploaded', function (objFile) {
    
        console.log('FILE UPLOADED:');
        console.log(objFile);
    });
    
    objRemoteFileWatcher.on('deleted', function (objFile) {
    
        console.log('FILE DELETED:');
        console.log(objFile);
    });
    
    objRemoteFileWatcher.on('error', function (strServername, error) {
        
            console.log('ERROR: ' + strServername);
            console.log(error);
        });
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago