Skip to content

Commit

Permalink
feat: add support for passing options to uploadFile, downloadFile and…
Browse files Browse the repository at this point in the history
… mkdir
  • Loading branch information
maitrungduc1410 committed Mar 1, 2022
1 parent 8254a60 commit 3769ece
Show file tree
Hide file tree
Showing 6 changed files with 2,924 additions and 44 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ src
tsconfig.json
tslint.json
test.js
.github
.github
.husky
commitlint.config.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.17](https://github.com/maitrungduc1410/node-scp-async/compare/v0.0.16...v0.0.17) (2021-11-08)


### Features

* allow passing options to `uploadFile`, `downloadFile` and `mkdir`

### [0.0.16](https://github.com/maitrungduc1410/node-scp-async/compare/v0.0.15...v0.0.16) (2021-11-08)


Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ Client({
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
}).then(client => {
client.uploadFile('./test.txt', '/workspace/test.txt')
client.uploadFile(
'./test.txt',
'/workspace/test.txt',
// options?: TransferOptions
)
.then(response => {
client.close() // remember to close connection after you finish
})
Expand All @@ -72,7 +76,11 @@ async function test() {
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
})
await client.uploadFile('./test.txt', '/workspace/test.txt')
await client.uploadFile(
'./test.txt',
'/workspace/test.txt',
// options?: TransferOptions
)
// you can perform upload multiple times
await client.uploadFile('./test1.txt', '/workspace/test1.txt')
client.close() // remember to close connection after you finish
Expand Down Expand Up @@ -101,7 +109,11 @@ Client({
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
}).then(client => {
client.downloadFile('/workspace/test.txt', './test.txt')
client.downloadFile(
'/workspace/test.txt',
'./test.txt',
// options?: TransferOptions
)
.then(response => {
client.close() // remember to close connection after you finish
})
Expand All @@ -127,7 +139,11 @@ async function test () {
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
})
await client.downloadFile('/workspace/test.txt', './test.txt')
await client.downloadFile(
'/workspace/test.txt',
'./test.txt',
// options?: TransferOptions
)
client.close() // remember to close connection after you finish
} catch(e) {
console.log(e)
Expand Down Expand Up @@ -260,7 +276,10 @@ Client({
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
}).then(client => {
client.mkdir('/server/path')
client.mkdir(
'/server/path',
// attributes?: InputAttributes
)
.then(response => {
client.close() // remember to close connection after you finish
})
Expand All @@ -286,7 +305,10 @@ async function test() {
// privateKey: fs.readFileSync('./key.pem'),
// passphrase: 'your key passphrase',
})
await client.mkdir('/server/path')
await client.mkdir(
'/server/path',
// attributes: InputAttributes
)
client.close() // remember to close connection after you finish
} catch (e) {
console.log(e)
Expand Down
Loading

0 comments on commit 3769ece

Please sign in to comment.