Just out of interest, I was wondering how others display file sizes when doing file listings from folders, so the end user sees the file size in either KB, MB, or GB.
I am looking for a more scalable way, without having to add a command for each scenario.
This works fine for KB, and MB, but would not scale up for GB, or at worst case scenario TB, unless I manually add more and more conditions to account for each.
Was wondering if in this day and age, with this being something pretty common, if there is a far simpler way.
Lol, this must be why SSD drives all have strange capacities these days, i mean back in the day everything was divisions of 8, now i buy a 250gb SSD or a 240GB SSD depending upon manufacturer.
It’s quite a pain for people like me that have a physical drive duplicator unit, as the spinning hard drives all seem to be slightly higher capacity than their SSD counterparts, and so the duplicator always moans.
I put a 250gb Seagate 7200rpm in bay 1 and a 250gb Samsung 850 EVO in bay 2, and the duplicator says, no, the SSD is too small.
I assume all that trouble is because of the info you just provided above.
I just checked and the formatter seems to be missing in the UI, perhaps @George can add it. As arguments you can pass the number of decimals and as a second argument a boolean for binary sizes. Default is 2 decimals and not using binary (divide by 1000 instead of 1024).
@George, while you adding the hmac stuff, can you please also add this formatSize() one too, i saw you were not assigned to this one, so just a reminder.