-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (40 loc) · 1.6 KB
/
index.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
require('dotenv').config()
const path = require('path')
const trelloBackup = require('./trello/backup')
const googleDrive = require('./authenticate')
const fileHelper = require('./helpers/file')
const run = async () => {
try {
//Store attachments locally
//const result = await trelloBackup.storeAttachmentsLocaly()
//Upload attachments to storage
//await googleDrive.createFolder('Trello')
//const file = await googleDrive.searchFiles('Trello')
//await googleDrive.simpleUpload('sample.txt', 'sample.txt')
/*
await googleDrive.createFolder('archive', 'Trello')
var generator = fileHelper.walk('archive')
setTimeout(function () {
const file = generator.next().value;
const pathParts = file.split(path.sep)
googleDrive.createFolder(pathParts[1], 'archive')
.then(() => {
googleDrive.createFolder(pathParts[2], pathParts[1])
.then(() => {
googleDrive.simpleUpload(pathParts[3], file, pathParts[2]).then(() => console.log('File uploaded'))
})
})
}, 5000)*/
return new Promise((resolve, reject) => {
const result = googleDrive.upload('archive/december/10/CTCNSCMSW08B_1.jpg')
result.then(() => {
resolve();
})
});
} catch (err) {
console.log(err)
}
}
run()
.then(() => console.log('Application finished successfuly.'))
.catch(err => console.error('There is error with app. ', err))