根据输入的byte单位计算出最简洁的表示数据
/*** 根据输入的byte单位,计算出最简洁的表示数据* 例如1024 得 1k*/function humanReadableSize(f_size) { return getSmartSize(f_size);}function getSmartSize(f_size) { var funit, k_size, m_size, g_size, f_size; k_size = f_size / 1024; m_size = k_size / 1024; g_size = m_size / 1024; if (1024 > f_size) { funit = 'b'; r_size = f_size; } else if (1024 > k_size) { funit = 'K'; r_size = Math.round(k_size); } else if (1024 > m_size) { funit = 'M'; r_size = Math.round(m_size * 10) / 10; } else { funit = 'G'; r_size = Math.round(g_size * 10) / 10; } return '' + r_size + funit;}function gen_size(val, li, sepa ) { sep = Math.pow(10, sepa); //小数点后的位数 li = Math.pow(10, li); //开始截断的长度 retval = val; unit = 'Bytes'; if (val >= li*1000000000) { val = Math.round( val / (1099511627776/sep) ) / sep; unit = 'TB'; } else if (val >= li*1000000) { val = Math.round( val / (1073741824/sep) ) / sep; unit = 'GB'; } else if (val >= li*1000) { val = Math.round( val / (1048576/sep) ) / sep; unit = 'MB'; } else if (val >= li) { val = Math.round( val / (1024/sep) ) / sep; unit = 'KB'; } return val + unit;}?