into filesize
for conversions
Convert value to filesize.
Signature
> into filesize {flags} ...rest
Parameters
...rest
: For a data structure input, convert data at the given cell paths.
Input/output types:
input | output |
---|---|
filesize | filesize |
int | filesize |
list<any> | list<filesize> |
list<filesize> | list<filesize> |
list<int> | list<filesize> |
list<number> | list<filesize> |
list<string> | list<filesize> |
number | filesize |
record | record |
string | filesize |
table | table |
Examples
Convert string to filesize in table
> [[device size]; ["/dev/sda1" "200"] ["/dev/loop0" "50"]] | into filesize size
╭───┬────────────┬───────╮
│ # │ device │ size │
├───┼────────────┼───────┤
│ 0 │ /dev/sda1 │ 200 B │
│ 1 │ /dev/loop0 │ 50 B │
╰───┴────────────┴───────╯
Convert string to filesize
> '2' | into filesize
2 B
Convert float to filesize
> 8.3 | into filesize
8 B
Convert int to filesize
> 5 | into filesize
5 B
Convert file size to filesize
> 4KB | into filesize
3.9 KiB
Convert string with unit to filesize
> '-1KB' | into filesize
-1,000 B