mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-28 20:40:06 +00:00
12 lines
397 B
JavaScript
12 lines
397 B
JavaScript
import getSpeed from './getSpeed.js'
|
|
import getBytesRemaining from './getBytesRemaining.js'
|
|
|
|
export default 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
|
|
}
|