-
Notifications
You must be signed in to change notification settings - Fork 1
/
old_primary.js
47 lines (37 loc) · 1.09 KB
/
old_primary.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
const obj = require(`./style.json`)
const wget = require('wget-improved')
const fs = require('fs')
console.log(obj)
options = {}
options.gunzip = true
const name = obj.genInfo.name
const author = obj.genInfo.author
const zipDown = obj.genInfo.download
let useZipDown
if (zipDown === "") {
useZipDown = false
} else if (zipDown === !"") {
useZipDown = true
}
const fileTotal = obj.files
const fileLength = Object.keys(fileTotal).length
let fileLengthLoop = fileLength
function runMain() {
let filesName = "file" + fileLengthLoop
const fileSection = "obj.files" + filesName
let fileName = fileSection.fileName
let output = './tempscripts/' + fileName + '.zip'
const outputDir = './tempscripts'
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir);
}
let download = wget.download(zipDown, output, options)
download.on('progress', function (progress) {
typeof progress === 'number'
});
while (fileLengthLoop != 0) {
console.log(filesName)
let location = fileSection.location
fileLengthLoop = fileLengthLoop - 1
}
}