jstd-web/node_modules/@uppy/utils/lib/getSpeed.js

10 lines
281 B
JavaScript
Raw Normal View History

2025-11-25 15:23:22 +08:00
"use strict";
function getSpeed(fileProgress) {
if (!fileProgress.bytesUploaded) return 0;
const timeElapsed = Date.now() - fileProgress.uploadStarted;
const uploadSpeed = fileProgress.bytesUploaded / (timeElapsed / 1000);
return uploadSpeed;
}
module.exports = getSpeed;