Skip to content

Commit 77b3db8

Browse files
committed
add port option
1 parent 24a3d30 commit 77b3db8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var options = {
1717
file: 'dump.sql'
1818
user: 'username',
1919
host: 'myServer',
20+
port: '22',
2021
path: '~'
2122
}
2223

@@ -41,6 +42,7 @@ scp.send({
4142
file: './file.txt', // local file to send
4243
user: 'username', // username to authenticate as on remote system
4344
host: 'myServer', // remote host to copy to, set up in your ~/.ssh/config
45+
port: '22', // remote port, optional, defaults to '22'
4446
path: '~' // remote path to save to (this would result in a ~/file.txt on myServer)
4547
});
4648
````
@@ -58,6 +60,7 @@ scp.get({
5860
file: '~/file.txt', // remote file to grab
5961
user: 'username', // username to authenticate as on remote system
6062
host: 'myServer', // remote host to transfer from, set up in your ~/.ssh/config
63+
port: '22', // remote port, optional, defaults to '22'
6164
path: '~' // local path to save to (this would result in a ~/file.txt on the local machine)
6265
});
6366
````

scp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ scp.send = function (options, cb) {
1313
var command = [
1414
'scp',
1515
'-r',
16+
'-P',
17+
(options.port == undefined ? '22' : options.port)
1618
options.file,
1719
(options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path,
1820
];

0 commit comments

Comments
 (0)