-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
42 lines (37 loc) · 1.06 KB
/
app.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
'use strict';
//console.dir(process.argv);
var perform = process.argv[2];
/* Includes download functionality */
var download = require('./lib/download');
/* Includes unzip functionality */
var file = require('./lib/unzip');
/* Includes convert functionality */
var data = require('./lib/convert');
/* Stores URLs in an array. */
var urls;
if(perform === 'download' || perform === 'unzip' || perform === 'convert'){
urls = process.argv.slice(3);
// Iterates through and downloads each link.
if(perform === 'download') {
urls.forEach(download.get);
}
// Unzip files.
if(perform === 'unzip') {
file.unzip();
console.log("Unzip me!");
}
// Converts .dat files to .json
if(perform === 'convert') {
console.log("Convert me!")
data.convert();
}
} else {
//console.dir(process.argv);
urls = process.argv.slice(2);
if(urls.length > 0) {
console.log("Your file" + ((urls.length > 1)?"s are":" is") + " being downloaded.");
urls.forEach(download.get);
} else {
console.log("Please specify if you would liike to 'download', 'unzip', or 'convert' your files.")
}
}