mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
fix (chunked): progress calculation
issue: 1. create a 2MB file: dd if=/dev/zero of=testfile bs=1024 count=2048 2. size chunk to 1MB what we see: progress up to 50%, then stop and jump to 100%
This commit is contained in:
@@ -330,7 +330,7 @@ function workerImplFile({ error, progress, speed }) {
|
||||
progress: (p) => {
|
||||
const chunksAlreadyDownloaded = i * chunkSize;
|
||||
const currentChunkDownloaded = p / 100 * (
|
||||
i !== numberOfChunks - 1 ? chunkSize : _file.size % chunkSize
|
||||
i !== numberOfChunks - 1 ? chunkSize : (_file.size % chunkSize) || chunkSize
|
||||
);
|
||||
progress(Math.floor(100 * (chunksAlreadyDownloaded + currentChunkDownloaded) / _file.size));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user