var sizeSymbols = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
var _formatSize = function (bytes) {
var i = -1;
do {
bytes = bytes / 1024;
i++;
} while (bytes > 99);
return Math.max(bytes, 0.1).toFixed(1) + sizeSymbols[i];
};
转载于:https://my.oschina.net/lvkun0223/blog/125415