humansize icon indicating copy to clipboard operation
humansize copied to clipboard

Calculate from sector counts in addition to byte count

Open mmstick opened this issue 5 years ago • 2 comments

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

mmstick avatar Oct 24 '18 16:10 mmstick

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.

LeopoldArkham avatar Oct 21 '19 16:10 LeopoldArkham

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.

mmstick avatar Oct 21 '19 17:10 mmstick