-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from wellwelwel/download-feat
feat: support download via SFTP
- Loading branch information
Showing
20 changed files
with
1,253 additions
and
729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { downloadFile } from '../../ssh.js'; | ||
import { DOWNLOAD } from '../../types/download.js'; | ||
|
||
export const downloads = async (paths: DOWNLOAD[]) => { | ||
console.log(`\n\x1b[22m\x1b[36m\x1b[1m⦿ Downloading Files\x1b[0m`); | ||
|
||
const uploadPromises = paths.map((path) => | ||
downloadFile(path.remote, path.local) | ||
); | ||
|
||
await Promise.all(uploadPromises); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface DOWNLOAD { | ||
/** | ||
* Path to local file or directory. | ||
* | ||
* For directories, it will upload every sub directories and their files. | ||
*/ | ||
local: string; | ||
/** | ||
* Absolute path to remote file or directory. It will ensure the remote path. | ||
* | ||
* --- | ||
* | ||
* Ex.: `/root/Documents/...` | ||
*/ | ||
remote: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { assert } from 'poku'; | ||
import { SVPS } from '../lib/index.js'; | ||
|
||
(async () => { | ||
const svps = new SVPS({ | ||
access: { | ||
host: process.env?.HOST || '127.0.0.1', | ||
username: String(process.env.USER), | ||
password: process.env.PASS, | ||
port: Number(process.env.PORT) || 22, | ||
}, | ||
}); | ||
|
||
const mount = await svps.mount(); | ||
|
||
await svps.end(); | ||
|
||
assert.strictEqual(mount, true, 'Basic Connection'); | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { assert } from 'poku'; | ||
import { SVPS } from '../lib/index.js'; | ||
|
||
(async () => { | ||
const svps = new SVPS({ | ||
access: { | ||
host: process.env?.HOST || '127.0.0.1', | ||
username: String(process.env.USER), | ||
password: process.env.PASS, | ||
port: Number(process.env.PORT) || 22, | ||
}, | ||
}); | ||
|
||
const commands = await svps.commands(['crontab -l']); | ||
|
||
await svps.end(); | ||
|
||
assert.strictEqual(commands, true, 'Personal commands'); | ||
})(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.