$bytes » History » Version 6
Per Amundsen, 02/18/2022 02:45 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | 6 | Per Amundsen | *$bytes(N,bkmgt3dp)* |
| 4 | 1 | Per Amundsen | |
| 5 | Returns comma formatted file-size. |
||
| 6 | |||
| 7 | 5 | Per Amundsen | _Supports "Big Integers":https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic_ |
| 8 | |||
| 9 | 1 | Per Amundsen | *Parameters* |
| 10 | |||
| 11 | 3 | Per Amundsen | N - The number to format. |
| 12 | 1 | Per Amundsen | b - Show N in bytes. |
| 13 | k - Show N in kilobytes. |
||
| 14 | m - Show N in megabytes. |
||
| 15 | g - Show N in gigabytes. |
||
| 16 | t - Show N in terabytes. |
||
| 17 | 3 - Show in 3 digits format. |
||
| 18 | d - *TODO* |
||
| 19 | 6 | Per Amundsen | p - Show N in petabytes. |
| 20 | 1 | Per Amundsen | |
| 21 | *Properties* |
||
| 22 | |||
| 23 | .suf - Appends the b, k, M, G, T suffixes to the result. |
||
| 24 | |||
| 25 | *Example* |
||
| 26 | |||
| 27 | <pre> |
||
| 28 | 2 | Per Amundsen | ; Returns 1. |
| 29 | 1 | Per Amundsen | //echo -ag $bytes(1024, k) |
| 30 | |||
| 31 | 2 | Per Amundsen | ; Returns 1KB. |
| 32 | 1 | Per Amundsen | //echo -ag $bytes(1024, k).suf |
| 33 | </pre> |