How do I determine the size of a file to read in Julia?

I would like to show the user the size of the file to read in Julia.

Python, for example, has humanize.naturalsize()


>>> humanize.naturalsize(1000000)
'1.0 MB'
>>> humanize.naturalsize(1000000, binary=True)
'976.6 KiB'


How can I achieve this in Julia?


source to share

1 answer

I don't believe there is a package for this, but the Python code is very short and should translate well to Julia.

EDIT: Actually I decided to make a package out of it: Humanize.jl which you can install withPkg.add("Humanize")



All Articles