https://github.com/dcousens/sibytes
A streaming, line-delimited, integer to SI unit bytes tool.
https://github.com/dcousens/sibytes
binary conversion cplusplus integer precision tool units
Last synced: over 1 year ago
JSON representation
A streaming, line-delimited, integer to SI unit bytes tool.
- Host: GitHub
- URL: https://github.com/dcousens/sibytes
- Owner: dcousens
- License: mit
- Created: 2019-12-04T00:57:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-27T12:23:29.000Z (over 5 years ago)
- Last Synced: 2025-01-23T20:35:05.504Z (over 1 year ago)
- Topics: binary, conversion, cplusplus, integer, precision, tool, units
- Language: C++
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sibytes
A streaming, line-delimited, integer to SI unit bytes tool.
The output is not rounded, precision is maintained.
Maximum input is a 64 bit integer, or `18446744073709551615`.
## Examples
``` bash
> echo '1' | sibytes
1 B
> echo '10' | sibytes
10 B
> echo '100' | sibytes
100 B
> echo '1000' | sibytes
1 kB
> echo '1077' | sibytes
1.077 kB
> echo '10000' | sibytes
10 kB
> echo '100000' | sibytes
100 kB
> echo '1000000' | sibytes
1 MB
...
> echo '162195527' | sibytes
162.195527 MB
> echo '1000000000000' | sibytes
1 TB
> echo -e '111\n2222\n4444224444' | sibytes
111 B
2.222 kB
4.444224444 GB
> echo '1000 foobar' | sibytes
1 kB
> echo '18446744073709551616' | sibytes
terminate called after throwing an instance of 'std::out_of_range'
what(): stol
> echo 'foobar' | sibytes
terminate called after throwing an instance of 'std::invalid_argument'
what(): stol
```
## LICENSE [MIT](LICENSE)