mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-24 02:38:58 +00:00
9 lines
328 B
TypeScript
9 lines
328 B
TypeScript
import type { FileProgress } from './FileProgress.js'
|
|
|
|
export default function getSpeed(fileProgress: FileProgress): number {
|
|
if (!fileProgress.bytesUploaded) return 0
|
|
|
|
const timeElapsed = Date.now() - fileProgress.uploadStarted
|
|
const uploadSpeed = fileProgress.bytesUploaded / (timeElapsed / 1000)
|
|
return uploadSpeed
|
|
}
|