Spaces:
Running
Running
Commit
·
1653a6c
1
Parent(s):
dda908e
Update index.html
Browse files- index.html +12 -3
index.html
CHANGED
@@ -101,13 +101,22 @@
|
|
101 |
|
102 |
// calculate elapsed time and speed
|
103 |
const elapsedTime = (Date.now() - startTime) / 1000; // in seconds
|
104 |
-
|
105 |
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
} else {
|
108 |
messageDiv.textContent = 'Please select a file to upload';
|
109 |
}
|
110 |
}
|
111 |
</script>
|
112 |
</body>
|
113 |
-
</html>
|
|
|
101 |
|
102 |
// calculate elapsed time and speed
|
103 |
const elapsedTime = (Date.now() - startTime) / 1000; // in seconds
|
104 |
+
let speed = totalSize / elapsedTime; // in MB/s
|
105 |
|
106 |
+
let speedUnit = 'MB/s';
|
107 |
+
if (speed < 1) {
|
108 |
+
speed *= 1024; // convert to KB/s
|
109 |
+
speedUnit = 'KB/s';
|
110 |
+
} else if (speed > 1024) {
|
111 |
+
speed /= 1024; // convert to GB/s
|
112 |
+
speedUnit = 'GB/s';
|
113 |
+
}
|
114 |
+
|
115 |
+
messageDiv.textContent = `All files uploaded successfully in ${elapsedTime.toFixed(2)} seconds, for all ${totalSize.toFixed(2)} MB in the ${files.length} files, speed ${speed.toFixed(2)} ${speedUnit}`;
|
116 |
} else {
|
117 |
messageDiv.textContent = 'Please select a file to upload';
|
118 |
}
|
119 |
}
|
120 |
</script>
|
121 |
</body>
|
122 |
+
</html>
|