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 fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const dl = require('download-file-with-progressbar');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getCurrentDirectoryBase: () => {
|
getCurrentDirectoryBase: () => {
|
||||||
@ -27,4 +28,19 @@ module.exports = {
|
|||||||
console.log(err)
|
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 compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
|
||||||
const value = await inquirer.compatibleApps();
|
const value = await inquirer.compatibleApps();
|
||||||
for (let element of value.removeAppsList) {
|
for (let element of value.removeAppsList) {
|
||||||
for (let element2 of compatibleApps) {
|
for (let element2 of compatibleApps) {
|
||||||
if (element === element2.name) {
|
if (element === element2.name) {
|
||||||
console.log(element2.url)
|
await files.downloadFile(element2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeApps: async () => {
|
removeApps: async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user