function byteCalculation(bytes) {
var bytes = parseInt(bytes);
var s = ['bytes', 'KBytes', 'MBytes', 'GBytes', 'TBytes', 'PBytes'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
if(e == "-Infinity") return "0 "+s[0];
else
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}
'웹스토리 > Jquery,Js' 카테고리의 다른 글
자바스크립트 다국어 처리 (0) | 2018.02.28 |
---|---|
JS 라이브러리 사이트 (0) | 2017.05.31 |
AXISJ 예제 소스 (0) | 2017.02.23 |
AngularJS 관련 사이트 (0) | 2015.02.25 |
js 툴 Aptana 설치 및 사용법 (0) | 2014.07.18 |