bytesize icon indicating copy to clipboard operation
bytesize copied to clipboard

An utility that easily makes bytes size representation and helps its arithmetic operations.

Results 30 bytesize issues
Sort by recently updated
recently updated
newest added

https://github.com/hyunsik/bytesize/blob/02822917468b14b6daa5bd76c0522a4f06a1188e/src/lib.rs#L63-L64 The two base values are backwards. This leads to the selection of the wrong unit; values larger than 1000 or lower than 1.0 can be displayed, e.g. "1090.0 GB"...

So that it is possible to use `{}` for decimal units (KB, MB, GB), and `{:#}` for binary units (KiB, MiB, GiB).

Currently, the effect of the `si_unit` argument of [`ByteSize::to_string_as`](https://docs.rs/bytesize/1.0.1/bytesize/struct.ByteSize.html#method.to_string_as) seems to be reversed. According to [Wikipedia](https://en.wikipedia.org/wiki/Binary_prefix), SI units are decimal units, and IEC units are binary units.

https://github.com/hyunsik/bytesize/pull/11 removed the implementation of `Sub` for `ByteSize` as well as the `as_usize` method. The example in the documentation tries to use both: https://github.com/hyunsik/bytesize/blob/9d8e13f05fe2fb2596a5534e86ef135af5bae6a3/src/lib.rs#L18 Trying to run this example results...

As of now an extremely ugly variant to get in #14. Works, though. Please review.

enhancement

```rust let block_sectors = 1953458176; let size = ByteSize::kib(block_sectors / 2); println!("{}", size); ``` ### Expected Output: ``` 931.48 GiB ``` ### Actual Output: ``` 1000.2 GB ```

enhancement

As someone who writes command line apps and likes pipes, I would like to have a `sort -h` friendly output, as in: ```console $ my-rust-app 5.5G foo 2.6G bar 16G...

I'd like to use this with a `no_std` crate I'm working on, but this crate doesn't seem to support that usage. Would it be possible to add a `std` feature...

wish

Hi there, thanks for the crate! While developing against the crate I found that human-readable serde impl's serializer is incorrect. For example, the following program: ```rust use bytesize::ByteSize; fn main()...

Trying to subtract two `ByteSize`, I noticed that `Sub` is not implemented. I can convert to u64 and sub, but it would be better if I could subtract directly.