Handbook
Glossary
file-size ( entry -- string )
Vocabulary
gemini
.
server
.
private
Inputs
entry
an
object
Outputs
string
an
object
Definition
USING:
accessors
combinators
formatting
io.files.info
kernel
math
;
IN:
gemini.server.private
:
file-size
( entry -- string )
dup
directory?
[
drop
"- "
]
[
size>>
{
{
[
dup
40
2^
>=
]
[
40
2^
/f
"TB"
]
}
{
[
dup
30
2^
>=
]
[
30
2^
/f
"GB"
]
}
{
[
dup
20
2^
>=
]
[
20
2^
/f
"MB"
]
}
[
10
2^
/f
"KB"
]
}
cond
"%.1f %s"
sprintf
]
if
;