Basically, I just want to run rsync command on node app.
The raw rsync code is the below:
rsync -r -t -p -o -g -v --progress --delete -l -H /Users/ken/Library/Application Support/Sublime Text 3/Packages /Users/ken/Google Drive/__config-GD/ST3
Firstly, I tried
child_process.exec(command, [options], callback)
but, since the rsync output is long, the buffer exceeded.
So, I tried
child_process.spawn(command, [args], [options])
instead, and stream.pipe out.
var spawn = require('child_process')
.spawn;
var ps = spawn(command1, args1)
.stdout
.pipe(process.stdout);
Although this works as expected, it is way too hard to split every original rsync command to the spawn format. (I copied and paste the command from gRsync tool)
Is there smart way to do this?
Thanks.