-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.mjs
executable file
·34 lines (29 loc) · 969 Bytes
/
main.mjs
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
#!/bin/sh
":" //# comment; exec /usr/bin/env node --experimental-modules "$0" "$@"
import fs from 'fs';
import readline from 'readline';
import {promisify} from 'util';
import authorize from './authorize.mjs';
import makeGDriveFolderBackup from './makeGDriveFolderBackup.mjs';
const readFile = promisify(fs.readFile);
// Load client secrets from a local file.
readFile('client_secret.json')
.then(content => authorize(JSON.parse(content)))
.then(auth => {
return new Promise((resolve, reject) => {
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Enter the google drive folder id you want to list: ', (id) => {
rl.close();
resolve(id);
});
})
.then(folderId => {
console.time('yo')
return makeGDriveFolderBackup(auth, folderId)
})
})
.then(() => console.timeEnd('yo'))
.catch(err => console.error(err))