Divide file size by 2^10 but display SI units

This commit is contained in:
JonnyWong16 2020-04-08 22:55:56 -07:00
parent 47610323b0
commit ae9df92d28
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 4 additions and 2 deletions

View file

@ -462,7 +462,8 @@ $('*').on('click', '.refresh_pms_image', function (e) {
// Taken from http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable#answer-14919494
function humanFileSize(bytes, si = true) {
var thresh = si ? 1000 : 1024;
//var thresh = si ? 1000 : 1024;
var thresh = 1024; // Always divide by 2^10 but display SI units
if (Math.abs(bytes) < thresh) {
return bytes + ' B';
}