mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-28 13:21:02 +00:00
14 lines
267 B
TypeScript
14 lines
267 B
TypeScript
export const calculateETA = (
|
|
totalLength: number,
|
|
completedLength: number,
|
|
speed: number
|
|
) => {
|
|
const remainingBytes = totalLength - completedLength;
|
|
|
|
if (remainingBytes >= 0 && speed > 0) {
|
|
return (remainingBytes / speed) * 1000;
|
|
}
|
|
|
|
return -1;
|
|
};
|