(x)
| 308 | } |
| 309 | |
| 310 | function stringifySize(x) { |
| 311 | let amount = x; |
| 312 | let unit = 'byte'; |
| 313 | if (x > 1e15) { |
| 314 | amount = x/1e15; |
| 315 | unit = 'PB'; |
| 316 | } else if (x > 1e12) { |
| 317 | amount = x/1e12; |
| 318 | unit = 'TB'; |
| 319 | } else if (x > 1e9) { |
| 320 | amount = x/1e9; |
| 321 | unit = 'GB'; |
| 322 | } else if (x > 1e6) { |
| 323 | amount = x/1e6; |
| 324 | unit = 'MB'; |
| 325 | } else if (x > 1e3) { |
| 326 | amount = x/1e3; |
| 327 | unit = 'KB'; |
| 328 | } |
| 329 | return amount.toFixed(2) + unit; |
| 330 | } |
| 331 | |
| 332 | function stringifyAgo(then, now) { |
| 333 | const diffInSeconds = Math.floor((now - then) / 1000); |