NodeJS file directory synchronization via http. Done with express and request modules.
Install the module on your project:
npm install sync-bin
Init a stand-alone server instance:
var sync = require('sync-bin');
sync.start(sync.init(),true);
or add it to your express app:
sync.config.host = '127.0.0.1';
sync.config.port = '8080';
sync.config.serve = 'assets';
sync.start(app);
sync.get('files/from','files/to',function(dir){
if (dir.error) return console.log('ERROR',dir.error);
console.log('Synchronizing!');
});
Customize the configuration to specify the correct routes:
{
host: 'localhost',
port: 8060,
url: 'sync',
key: 'path',
delay: 10,
serve: 'files'
}