Spaces:
Running
Running
Commit
·
dda908e
1
Parent(s):
d297f1b
Update index.html
Browse files- index.html +15 -1
index.html
CHANGED
@@ -50,6 +50,16 @@
|
|
50 |
errorDiv.textContent = ''; // clear previous errors
|
51 |
|
52 |
if (files.length > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
try {
|
54 |
// Attempt to create the repo
|
55 |
await createRepo({
|
@@ -89,7 +99,11 @@
|
|
89 |
}
|
90 |
}
|
91 |
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
} else {
|
94 |
messageDiv.textContent = 'Please select a file to upload';
|
95 |
}
|
|
|
50 |
errorDiv.textContent = ''; // clear previous errors
|
51 |
|
52 |
if (files.length > 0) {
|
53 |
+
// calculate total size in MB
|
54 |
+
let totalSize = 0;
|
55 |
+
for (let file of files) {
|
56 |
+
totalSize += file.size;
|
57 |
+
}
|
58 |
+
totalSize = totalSize / (1024 * 1024); // convert to MB
|
59 |
+
|
60 |
+
// start time
|
61 |
+
const startTime = Date.now();
|
62 |
+
|
63 |
try {
|
64 |
// Attempt to create the repo
|
65 |
await createRepo({
|
|
|
99 |
}
|
100 |
}
|
101 |
|
102 |
+
// calculate elapsed time and speed
|
103 |
+
const elapsedTime = (Date.now() - startTime) / 1000; // in seconds
|
104 |
+
const speed = totalSize / elapsedTime; // in MB/s
|
105 |
+
|
106 |
+
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)} MB/s`;
|
107 |
} else {
|
108 |
messageDiv.textContent = 'Please select a file to upload';
|
109 |
}
|