$bytes » History » Version 5
Per Amundsen, 09/09/2020 10:02 AM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$bytes(N,bkmgt3d)* |
||
4 | |||
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 | 4 | Per Amundsen | d - *TODO* |
19 | 1 | Per Amundsen | |
20 | *Properties* |
||
21 | |||
22 | .suf - Appends the b, k, M, G, T suffixes to the result. |
||
23 | |||
24 | *Example* |
||
25 | |||
26 | <pre> |
||
27 | 2 | Per Amundsen | ; Returns 1. |
28 | 1 | Per Amundsen | //echo -ag $bytes(1024, k) |
29 | |||
30 | 2 | Per Amundsen | ; Returns 1KB. |
31 | 1 | Per Amundsen | //echo -ag $bytes(1024, k).suf |
32 | </pre> |