Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F325725
file_size_format.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
450 B
Referenced Files
None
Subscribers
None
file_size_format.js
View Options
const
fileSizeFormat
=
(
numArg
)
=>
{
const
units
=
[
'B'
,
'KiB'
,
'MiB'
,
'GiB'
,
'TiB'
]
let
num
=
numArg
if
(
num
<
1
)
{
return
num
+
' '
+
units
[
0
]
}
const
exponent
=
Math
.
min
(
Math
.
floor
(
Math
.
log
(
num
)
/
Math
.
log
(
1024
)),
units
.
length
-
1
)
num
=
(
num
/
Math
.
pow
(
1024
,
exponent
)).
toFixed
(
2
)
*
1
const
unit
=
units
[
exponent
]
return
{
num
,
unit
}
}
const
fileSizeFormatService
=
{
fileSizeFormat
}
export
default
fileSizeFormatService
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 24, 4:21 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
95985
Default Alt Text
file_size_format.js (450 B)
Attached To
Mode
rPUFE pleroma-fe-upstream
Attached
Detach File
Event Timeline
Log In to Comment