[Updater > Module] Minor source cleanup
This commit is contained in:
parent
9bf21e63d1
commit
61d3201843
|
@ -195,16 +195,12 @@ const downloadModule = async (name, ver) => {
|
||||||
const path = join(downloadPath, name + '-' + ver + '.zip');
|
const path = join(downloadPath, name + '-' + ver + '.zip');
|
||||||
const stream = fs.createWriteStream(path);
|
const stream = fs.createWriteStream(path);
|
||||||
|
|
||||||
stream.on('progress', ([cur, total]) => {
|
stream.on('progress', ([ cur, total ]) => events.emit('downloading-module-progress', {
|
||||||
const progress = Math.min(100, Math.floor(100 * (cur / total)));
|
name,
|
||||||
|
progress: Math.min(100, Math.floor(100 * (cur / total))),
|
||||||
events.emit('downloading-module-progress', {
|
cur,
|
||||||
name,
|
total
|
||||||
progress,
|
}));
|
||||||
cur,
|
|
||||||
total
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
log('Modules', 'Downloading', `${name}@${ver}`, 'from', url, 'to', path);
|
log('Modules', 'Downloading', `${name}@${ver}`, 'from', url, 'to', path);
|
||||||
|
|
||||||
|
@ -304,11 +300,9 @@ const installModule = async (name, ver, path) => {
|
||||||
if (!y.includes('inflating')) return;
|
if (!y.includes('inflating')) return;
|
||||||
|
|
||||||
cur++;
|
cur++;
|
||||||
const progress = Math.min(100, Math.floor(cur / total * 100));
|
|
||||||
|
|
||||||
events.emit('installing-module-progress', {
|
events.emit('installing-module-progress', {
|
||||||
name,
|
name,
|
||||||
progress,
|
progress: Math.min(100, Math.floor(cur / total * 100)),
|
||||||
cur,
|
cur,
|
||||||
total
|
total
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue