UNPKG
@pit-front-end/utils
Version:
latest (1.0.9)
1.0.73
1.0.72
1.0.71
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
湖南创智艾泰克科技有限公司
@pit-front-end/utils
/
dist
/
es
/
file.js
10 lines
(9 loc)
•
239 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
function
e
(
t
) {
if
(
Number
(t) <=
0
)
return
"0 B"
;
const
r = [
"B"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
], o =
Math
.
floor
(
Math
.
log
(t) /
Math
.
log
(
1024
));
return
(t /
Math
.
pow
(
1024
, o)).
toFixed
(
2
) +
" "
+ r[o]; }
export
{ e
as
getFileSizeStr };