1 | const getSpeed = require('./getSpeed')
|
2 | const getBytesRemaining = require('./getBytesRemaining')
|
3 |
|
4 | module.exports = function getETA (fileProgress) {
|
5 | if (!fileProgress.bytesUploaded) return 0
|
6 |
|
7 | const uploadSpeed = getSpeed(fileProgress)
|
8 | const bytesRemaining = getBytesRemaining(fileProgress)
|
9 | const secondsRemaining = Math.round(bytesRemaining / uploadSpeed * 10) / 10
|
10 |
|
11 | return secondsRemaining
|
12 | }
|