You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
435 B
15 lines
435 B
|
2 years ago
|
"use strict";
|
||
|
|
|
||
|
|
const getSpeed = require("./getSpeed.js");
|
||
|
|
|
||
|
|
const getBytesRemaining = require("./getBytesRemaining.js");
|
||
|
|
|
||
|
|
function getETA(fileProgress) {
|
||
|
|
if (!fileProgress.bytesUploaded) return 0;
|
||
|
|
const uploadSpeed = getSpeed(fileProgress);
|
||
|
|
const bytesRemaining = getBytesRemaining(fileProgress);
|
||
|
|
const secondsRemaining = Math.round(bytesRemaining / uploadSpeed * 10) / 10;
|
||
|
|
return secondsRemaining;
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = getETA;
|