mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Updated output
This commit is contained in:
parent
63a1f5913d
commit
0d2fa16bfd
1 changed files with 20 additions and 11 deletions
31
funi.js
31
funi.js
|
|
@ -566,7 +566,12 @@ async function downloadStreams(){
|
||||||
}
|
}
|
||||||
key = crypto.createDecipheriv('aes-128-cbc', key, iv);
|
key = crypto.createDecipheriv('aes-128-cbc', key, iv);
|
||||||
|
|
||||||
let last = 0;
|
let progress, intervall;
|
||||||
|
|
||||||
|
function logInfo() {
|
||||||
|
if (progress && progress.percent && progress.transferred)
|
||||||
|
console.log(`[INFO] Downloaded ${progress.percent.toFixed(2) * 100}% (${(progress.transferred/1024).toFixed(0)}kb/${progress.total?(progress.total/1024).toFixed(0) + 'kb':'unknown'})`);
|
||||||
|
}
|
||||||
|
|
||||||
let res = (await got({
|
let res = (await got({
|
||||||
url: chunk.uri,
|
url: chunk.uri,
|
||||||
|
|
@ -575,12 +580,12 @@ async function downloadStreams(){
|
||||||
},
|
},
|
||||||
responseType: 'buffer'
|
responseType: 'buffer'
|
||||||
}).on("downloadProgress", (pro) => {
|
}).on("downloadProgress", (pro) => {
|
||||||
if (pro.percent.toFixed(2) * 100 > last + 5) {
|
progress = pro
|
||||||
console.log(`[INFO] Downloaded ${pro.percent.toFixed(2) * 100}%`);
|
if (intervall === undefined)
|
||||||
last = pro.percent.toFixed(2) * 100;
|
intervall = setInterval(logInfo, 2500)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => console.log(`[ERROR] ${error.name}: ${error.code||error.message}`)))
|
.catch(error => console.log(`[ERROR] ${error.name}: ${error.code||error.message}`)))
|
||||||
|
clearInterval(intervall)
|
||||||
|
|
||||||
if (!res.body) { return; }
|
if (!res.body) { return; }
|
||||||
let dec = key.update(res.body);
|
let dec = key.update(res.body);
|
||||||
|
|
@ -664,7 +669,12 @@ async function downloadStreams(){
|
||||||
}
|
}
|
||||||
key = crypto.createDecipheriv('aes-128-cbc', key, iv);
|
key = crypto.createDecipheriv('aes-128-cbc', key, iv);
|
||||||
|
|
||||||
let last = 0;
|
let progress, intervall;
|
||||||
|
|
||||||
|
function logInfo() {
|
||||||
|
if (progress && progress.percent && progress.transferred)
|
||||||
|
console.log(`[INFO] Downloaded ${progress.percent.toFixed(2) * 100}% (${(progress.transferred/1024).toFixed(0)}kb/${progress.total?(progress.total/1024).toFixed(0) + 'kb':'unknown'})`);
|
||||||
|
}
|
||||||
|
|
||||||
let res = (await got({
|
let res = (await got({
|
||||||
url: chunk.uri,
|
url: chunk.uri,
|
||||||
|
|
@ -673,13 +683,12 @@ async function downloadStreams(){
|
||||||
},
|
},
|
||||||
responseType: 'buffer'
|
responseType: 'buffer'
|
||||||
}).on("downloadProgress", (pro) => {
|
}).on("downloadProgress", (pro) => {
|
||||||
if (pro.percent.toFixed(2) * 100 > last + 5) {
|
progress = pro
|
||||||
console.log(`[INFO] Downloaded ${pro.percent.toFixed(2) * 100}%`);
|
if (intervall === undefined)
|
||||||
last = pro.percent.toFixed(2) * 100;
|
intervall = setInterval(logInfo, 2500)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => console.log(`[ERROR] ${error.name}: ${error.code||error.message}`)))
|
.catch(error => console.log(`[ERROR] ${error.name}: ${error.code||error.message}`)))
|
||||||
|
clearInterval(intervall)
|
||||||
if (!res.body) { return; }
|
if (!res.body) { return; }
|
||||||
let dec = key.update(res.body);
|
let dec = key.update(res.body);
|
||||||
dec = Buffer.concat([dec, key.final()]);
|
dec = Buffer.concat([dec, key.final()]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue