UNPKG
@nikolarhristov/pipeline
Version:
latest (0.1.7)
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
🧪 Pipeline for files.
github.com/nikolaxhristov/pipeline
nikolaxhristov/pipeline
@nikolarhristov/pipeline
/
dist
/
lib
/
format-bytes.js
2 lines
(1 loc)
•
225 B
JavaScript
View Raw
1
2
var
a
=
async
(
t,B=
2
)=>{
if
(t===
0
)
return
"0 Bytes"
;
const
o=
1024
,r=
Math
.
floor
(
Math
.
log
(t)/
Math
.
log
(o));
return
`
${
parseFloat
((t/o**r).toFixed(B<
0
?
0
:B))}
${[
"Bytes"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
,
"PB"
,
"EB"
,
"ZB"
,
"YB"
][r]}
`
};
export
{a
as
default
};