added progress download progress notifications (#36)

This commit is contained in:
Micah Lee 2014-06-11 19:45:10 -04:00
parent 62c1045aa6
commit 68bba73a8c
5 changed files with 63 additions and 10 deletions

View file

@ -0,0 +1,11 @@
function human_readable_filesize(bytes, si) {
var thresh = si ? 1000 : 1024;
if(bytes < thresh) return bytes + ' B';
var units = si ? ['kB','MB','GB','TB','PB','EB','ZB','YB'] : ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while(bytes >= thresh);
return bytes.toFixed(1)+' '+units[u];
};