working donwload
This commit is contained in:
parent
f7ba26ff3a
commit
a2794d0b2c
16
lib/files.js
16
lib/files.js
@ -1,5 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const dl = require('download-file-with-progressbar');
|
||||
|
||||
module.exports = {
|
||||
getCurrentDirectoryBase: () => {
|
||||
@ -27,4 +28,19 @@ module.exports = {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
downloadFile: async (element) => {
|
||||
option = {
|
||||
dir: './data/apps',
|
||||
onDone: (info)=>{
|
||||
console.log(element.name + ' Downloaded')
|
||||
},
|
||||
onError: (err) => {
|
||||
console.log('error', err);
|
||||
},
|
||||
onProgress: (curr, total) => {
|
||||
},
|
||||
}
|
||||
|
||||
var dd = dl(element.url, option);
|
||||
}
|
||||
};
|
@ -11,11 +11,11 @@ module.exports = {
|
||||
const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
|
||||
const value = await inquirer.compatibleApps();
|
||||
for (let element of value.removeAppsList) {
|
||||
for (let element2 of compatibleApps) {
|
||||
if (element === element2.name) {
|
||||
console.log(element2.url)
|
||||
}
|
||||
}
|
||||
for (let element2 of compatibleApps) {
|
||||
if (element === element2.name) {
|
||||
await files.downloadFile(element2)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
removeApps: async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user