Skip to content

Instantly share code, notes, and snippets.

@rockydd
rockydd / nubToBytes
Last active August 29, 2015 14:20 — forked from anonymous/nubToBytes
Object.defineProperty(Number.prototype,'fileSize',{value:function(a,b,c,d){
if(this == 0){
return "0.0 B";
}else if(this < 0.001){
return this.toExponential(1) + " B";
}else if(this < 1){
return this.toLocaleString() + " B";
}
return (a=a?[1e3,'k','B']:[1024,'K','iB'],b=Math,c=b.log,