LeopoldArkham/humansize

Calculate from sector counts in addition to byte count

mmstick opened this issue · 3 comments

For the use case of displaying unit sizes for block devices, which are measured in sectors instead of bytes (512 bytes per sector).

Hey, better late than never!

What would you expect from this, a different function someNumber.sector_size(options) or the same function with an extra flag in the options?

Is it always 512 bytes or does that need to change?

Are there any other things you would expect to be able to customise for this use case?

Out of curiosity, what project/use case would you like this for, if it's available publicly?

Thanks in advance.

The sector size isn't guaranteed to be 512. It's the most common sector size, but some SSDs and magnetic drives are using 4096 byte sector sizes.