Humanize.jl is an old but nice package to convert e.g. 1248923592
to “1.2 GB”. but i need to go the other way around. simple to write some bespoke code myself to do this, but is there a package around? couldn’t find one hence the question here.
How about just shelling out to NUMFMT(1)
? It’s not a package, but probably still better than writing the code yourself.
$ echo 1.2GB | numfmt --from=iec --suffix=B
1288490189B
I think you basically want a Base.parse
specialization for Unitful.jl? Sounds like it would be a good addition to the ecosystem.
Unfortunately Unitful doesn’t have information units. The PR adding them has been stalled for 3 years now.
1 Like
Perhaps we could use Unitful.jl as part of the solution, but I already sense some ambiguity. Do you mean 1.2 * 10^6
bytes or 1.2 * 1048576
bytes (1.2 GiB)?
2 Likes