$bytes » History » Version 7
Per Amundsen, 02/16/2023 09:10 PM
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 | 7 | Per Amundsen | table(ktable). |
12 | |*Parameter*|*Description*| |
||
13 | | N | The number to format. | |
||
14 | | b | Show N in bytes. | |
||
15 | | k | Show N in kilobytes. | |
||
16 | | m | Show N in megabytes. | |
||
17 | | g | Show N in gigabytes. | |
||
18 | | t | Show N in terabytes. | |
||
19 | | 3 | Show in 3 digits format. | |
||
20 | | d | *TODO* | |
||
21 | | p | Show N in petabytes. | |
||
22 | 1 | Per Amundsen | |
23 | 6 | Per Amundsen | *Properties* |
24 | 1 | Per Amundsen | |
25 | 7 | Per Amundsen | table(ktable). |
26 | |*Property*|*Description*| |
||
27 | | .suf | Appends the b, k, M, G, T suffixes to the result. | |
||
28 | 1 | Per Amundsen | |
29 | *Example* |
||
30 | |||
31 | <pre> |
||
32 | 2 | Per Amundsen | ; Returns 1. |
33 | 1 | Per Amundsen | //echo -ag $bytes(1024, k) |
34 | |||
35 | 2 | Per Amundsen | ; Returns 1KB. |
36 | 1 | Per Amundsen | //echo -ag $bytes(1024, k).suf |
37 | </pre> |