From 6c09024a5c0cba759bc0a40e353a146e77d14cf2 Mon Sep 17 00:00:00 2001 From: appr Date: Wed, 13 Jun 2012 15:45:33 +0400 Subject: [PATCH 1/2] 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/2] 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);