# Inverse of Humanize.jl

**URL:** https://discourse.julialang.org/t/inverse-of-humanize-jl/113648
**Category:** General Usage
**Tags:** question
**Created:** [April 30, 2024, 1:02pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648 "2024-04-30T13:02:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)
#### Post date: [April 30, 2024, 1:02pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648/1 "2024-04-30T13:02:57Z")

</div>

[Humanize.jl](https://github.com/IainNZ/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.

---

<div class="post-metadata">

### Author: ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)
#### Post date: [April 30, 2024, 1:18pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648/2 "2024-04-30T13:18:18Z")

</div>

How about just shelling out to `NUMFMT(1)`? It’s not a package, but probably still better than writing the code yourself.

```sh
$ echo 1.2GB | numfmt --from=iec --suffix=B
1288490189B

```

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [April 30, 2024, 1:23pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648/3 "2024-04-30T13:23:51Z")

</div>

I think you basically want a `Base.parse` specialization for Unitful.jl? Sounds like it would be a good addition to the ecosystem.

---

<div class="post-metadata">

### Author: ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)
#### Post date: [April 30, 2024, 2:07pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648/4 "2024-04-30T14:07:54Z")

</div>

Unfortunately Unitful doesn’t have information units. The [PR adding them](https://github.com/PainterQubits/Unitful.jl/pull/419) has been stalled for 3 years now.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [April 30, 2024, 2:20pm UTC](https://discourse.julialang.org/t/inverse-of-humanize-jl/113648/5 "2024-04-30T14:20:56Z")

</div>

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)?
