mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-29 21:13:21 +00:00
13 lines
472 B
TypeScript
13 lines
472 B
TypeScript
import type { FileProgress } from './FileProgress.js'
|
|
import getBytesRemaining from './getBytesRemaining.js'
|
|
import getSpeed from './getSpeed.js'
|
|
|
|
export default function getETA(fileProgress: FileProgress): number {
|
|
if (!fileProgress.bytesUploaded) return 0
|
|
|
|
const uploadSpeed = getSpeed(fileProgress)
|
|
const bytesRemaining = getBytesRemaining(fileProgress)
|
|
const secondsRemaining = Math.round((bytesRemaining / uploadSpeed) * 10) / 10
|
|
|
|
return secondsRemaining
|
|
}
|