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.
Currently I would do something like this.
<td dmx-text="size >= 1000000 ? ((size / 1000) / 1000).ceil().toString().concat(' MB') : (size / 1000).ceil().toString().concat(' KB')"></td>
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.