$bytes » History » Version 2
Per Amundsen, 08/09/2015 06:07 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$bytes(N,bkmgt3d)* |
||
| 4 | |||
| 5 | Returns comma formatted file-size. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | N - The number to format. _double_ |
||
| 10 | b - Show N in bytes. |
||
| 11 | k - Show N in kilobytes. |
||
| 12 | m - Show N in megabytes. |
||
| 13 | g - Show N in gigabytes. |
||
| 14 | t - Show N in terabytes. |
||
| 15 | 3 - Show in 3 digits format. |
||
| 16 | d - TODO |
||
| 17 | |||
| 18 | *Properties* |
||
| 19 | |||
| 20 | .suf - Appends the b, k, M, G, T suffixes to the result. |
||
| 21 | |||
| 22 | *Example* |
||
| 23 | |||
| 24 | <pre> |
||
| 25 | 2 | Per Amundsen | ; Returns 1. |
| 26 | 1 | Per Amundsen | //echo -ag $bytes(1024, k) |
| 27 | |||
| 28 | 2 | Per Amundsen | ; Returns 1KB. |
| 29 | 1 | Per Amundsen | //echo -ag $bytes(1024, k).suf |
| 30 | </pre> |