windows do not support rsync !! rsync like purely in Node.

That's a large task, so the first step is to implement the part I actually need. Namely:

rsync --archive --delete localdir user@server:remotedir


var sftp2sync = require('sftp2sync');

//var root_local = process.env["HOME"] + "/test/out";
var root_local = "./";
var root_remote = "/home/xxxxx/public_html";
var force = false;
var exclude = [''];

sftp2sync.upload(root_local, root_remote, force, excludes, {

    //    debug: console.log,
      host: '',
      //host: 'localhost',
      port: 22,
      username: 'root',
      privateKey: require('fs').readFileSync('keys'),
      passphrase: ''
      password: 'password'

ToDo: recursive delete imperfectly