Better naming and faster progress bar
This commit is contained in:
parent
e6dc9292a6
commit
5e0071f15d
2 changed files with 4 additions and 3 deletions
|
@ -15,7 +15,7 @@
|
||||||
<div
|
<div
|
||||||
class="h-full bg-gradient-to-r from-green-400 to-green-600 transition-all duration-300"
|
class="h-full bg-gradient-to-r from-green-400 to-green-600 transition-all duration-300"
|
||||||
style="width: {progress}%"
|
style="width: {progress}%"
|
||||||
/>
|
> </div>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-2 text-center text-pink-400">{progress}%</p>
|
<p class="mt-2 text-center text-pink-400">{progress}%</p>
|
||||||
</div>
|
</div>
|
|
@ -2,7 +2,7 @@
|
||||||
import { PUBLIC_VERSION } from '$env/static/public';
|
import { PUBLIC_VERSION } from '$env/static/public';
|
||||||
import supportedFormats from '$lib/common/supportedFormats.json';
|
import supportedFormats from '$lib/common/supportedFormats.json';
|
||||||
import Loader from '$lib/components/Loader.svelte';
|
import Loader from '$lib/components/Loader.svelte';
|
||||||
import DownloadManager from '$lib/components/DownloadManager.svelte';
|
import DownloadManager from '$lib/components/ProgressBar.svelte';
|
||||||
import { mount, unmount } from 'svelte';
|
import { mount, unmount } from 'svelte';
|
||||||
|
|
||||||
let source = $state('youtube');
|
let source = $state('youtube');
|
||||||
|
@ -44,13 +44,14 @@
|
||||||
const chunks: Uint8Array[] = [];
|
const chunks: Uint8Array[] = [];
|
||||||
let receivedLength = 0;
|
let receivedLength = 0;
|
||||||
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value }: ReadableStreamReadResult<Uint8Array> = await reader!.read();
|
const { done, value }: ReadableStreamReadResult<Uint8Array> = await reader!.read();
|
||||||
if (done) break;
|
if (done) break;
|
||||||
if (value) {
|
if (value) {
|
||||||
chunks.push(value);
|
chunks.push(value);
|
||||||
receivedLength += value.length;
|
receivedLength += value.length;
|
||||||
progress = Math.round((receivedLength / 150000) * 100);
|
progress = Math.round((receivedLength / 50000) * 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue