Skip to content

Commit

Permalink
Fixed reported speed being incorrect due to startTime offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 26, 2023
1 parent fe3fa3a commit d39578c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Downloader.ts
Expand Up @@ -109,13 +109,14 @@ const processVideo = async (video: Video, retries = 0) => {
message: "Waiting on delivery cdn...",
});

const startTime = Date.now();
let startTime;

if (args.headless === true) console.log(`${fTitle} - Waiting on delivery cdn...`);

const downloadRequest = await video.download(settings.floatplane.videoResolution);

downloadRequest.on("downloadProgress", (downloadProgress: DownloadProgress) => {
startTime ??= Date.now();
const timeElapsed = (Date.now() - startTime) / 1000;

const totalMB = downloadProgress.total / 1024000;
Expand Down

0 comments on commit d39578c

Please sign in to comment.