-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscp.js
50 lines (45 loc) · 1.17 KB
/
scp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const { Client } = require('node-scp')
const dotenv = require("dotenv").config();
const ssh = require("./ssh");
const VMAToBoole = "/Users/chrisdrakeford/apitest/"
const booleFromVMA = "/home/cdrakeford/voice_input/"
const booleToVMA = "/home/cdrakeford/voice_output"
const VMAFromBoole = "/Users/chrisdrakeford/voice_output"
function scp1(fileName)
{
Client({
host: process.env.BOOLE,
port: 22,
username: process.env.SSH_USER,
password: process.env.SSH_PASSWORD,
tryKeyboard: true,
}).then(client => {
client.uploadFile(VMAToBoole + fileName, booleFromVMA+ fileName)
.then(response => {
console.log(fileName + " uploaded to boole")
client.close()
})
.catch(error => {})
}).catch(e => console.log(e))
}
function scp2()
{
Client({
host: process.env.BOOLE,
port: 22,
username: process.env.SSH_USER,
password: process.env.SSH_PASSWORD,
tryKeyboard: true,
}).then(client => {
client.downloadDir(booleToVMA , VMAFromBoole)
.then(response => {
console.log("Downloaded to vma")
client.close()
})
.catch(error => {})
}).catch(e => console.log(e))
}
module.exports = {
scp1,
scp2,
}