MCPcopy Create free account
hub / github.com/error311/FileRise / estimateProgress

Function estimateProgress

public/js/transferProgress.js:507–513  ·  view source on GitHub ↗
(job, elapsedMs)

Source from the content-addressed store, hash-verified

505}
506
507function estimateProgress(job, elapsedMs) {
508 const totalBytes = Number(job.totalBytes || 0);
509 const estimateMs = Math.max(MIN_ESTIMATE_MS, (totalBytes / job.estimateBps) * 1000);
510 const ratio = Math.min(0.95, elapsedMs / estimateMs);
511 const doneBytes = Math.min(totalBytes, Math.floor(totalBytes * ratio));
512 return { ratio, doneBytes };
513}
514
515function estimateElapsedProgress(job, elapsedMs, totalBytes, doneBytes = 0) {
516 if (!Number.isFinite(totalBytes) || totalBytes <= 0) return null;

Callers 1

renderJobFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected