From 6c09024a5c0cba759bc0a40e353a146e77d14cf2 Mon Sep 17 00:00:00 2001 From: appr Date: Wed, 13 Jun 2012 15:45:33 +0400 Subject: [PATCH 1/3] added missing comma --- scp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scp.js b/scp.js index 592ca67..fb7e569 100644 --- a/scp.js +++ b/scp.js @@ -14,7 +14,7 @@ scp.send = function (options, cb) { 'scp', '-r', '-P', - (options.port == undefined ? '22' : options.port) + (options.port == undefined ? '22' : options.port), options.file, (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path, ]; From 069981656ff17d3d5581feb0ac6405fc04c105ab Mon Sep 17 00:00:00 2001 From: appr Date: Wed, 13 Jun 2012 16:59:31 +0400 Subject: [PATCH 2/3] add support for identity file (-i scp option) --- scp.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scp.js b/scp.js index fb7e569..3329db5 100644 --- a/scp.js +++ b/scp.js @@ -14,10 +14,15 @@ scp.send = function (options, cb) { 'scp', '-r', '-P', - (options.port == undefined ? '22' : options.port), - options.file, - (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path, + (options.port == undefined ? '22' : options.port) ]; + if (options.identityFile) { + command.push('-i', options.identityFile); + } + command.push( + options.file, + (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path + ); exec(command.join(' '), function (err, stdout, stderr) { if (cb) { cb(err, stdout, stderr); @@ -33,10 +38,15 @@ scp.send = function (options, cb) { scp.get = function (options, cb) { var command = [ 'scp', - '-r', + '-r' + ]; + if (options.identityFile) { + command.push('-i', options.identityFile); + } + command.push( (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.file, options.path - ]; + ); exec(command.join(' '), function (err, stdout, stderr) { if (cb) { cb(err, stdout, stderr); From a5247650b65a967491963757ff0a2ab1467a7480 Mon Sep 17 00:00:00 2001 From: appr Date: Wed, 13 Jun 2012 17:37:50 +0400 Subject: [PATCH 3/3] support for batch mode (-B scp option) --- scp.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scp.js b/scp.js index 3329db5..af8de5f 100644 --- a/scp.js +++ b/scp.js @@ -19,6 +19,9 @@ scp.send = function (options, cb) { if (options.identityFile) { command.push('-i', options.identityFile); } + if (options.batchMode) { + command.push('-B'); + } command.push( options.file, (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path @@ -43,6 +46,9 @@ scp.get = function (options, cb) { if (options.identityFile) { command.push('-i', options.identityFile); } + if (options.batchMode) { + command.push('-B'); + } command.push( (options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.file, options.path