Better naming and faster progress bar

This commit is contained in:
0d0 2025-04-22 20:57:01 +02:00
parent e6dc9292a6
commit 5e0071f15d
2 changed files with 4 additions and 3 deletions

View file

@ -15,7 +15,7 @@
<div
class="h-full bg-gradient-to-r from-green-400 to-green-600 transition-all duration-300"
style="width: {progress}%"
/>
> </div>
</div>
<p class="mt-2 text-center text-pink-400">{progress}%</p>
</div>

View file

@ -2,7 +2,7 @@
import { PUBLIC_VERSION } from '$env/static/public';
import supportedFormats from '$lib/common/supportedFormats.json';
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';
let source = $state('youtube');
@ -44,13 +44,14 @@
const chunks: Uint8Array[] = [];
let receivedLength = 0;
while (true) {
const { done, value }: ReadableStreamReadResult<Uint8Array> = await reader!.read();
if (done) break;
if (value) {
chunks.push(value);
receivedLength += value.length;
progress = Math.round((receivedLength / 150000) * 100);
progress = Math.round((receivedLength / 50000) * 100);
}
}