Home Explore Blog CI



nushell

commands/docs/into_filesize.md
d2111d2967cfdd873028be61aa77a65129335f1b07302b720000000300000788
---
title: into filesize
categories: |
  conversions
version: 0.104.0
conversions: |
  Convert value to filesize.
usage: |
  Convert value to filesize.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `into filesize` for [conversions](/commands/categories/conversions.md)

<div class='command-title'>Convert value to filesize.</div>

## 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
```nu
> [[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
```nu
> '2' | into filesize
2 B
```

Convert float to filesize
```nu
> 8.3 | into filesize
8 B
```

Convert int to filesize
```nu
> 5 | into filesize
5 B
```

Convert file size to filesize
```nu
> 4KB | into filesize
4.0 kB
```

Convert string with unit to filesize
```nu
> '-1KB' | into filesize
-1.0 kB
```

Chunks
a6fa34f2 (1st chunk of `commands/docs/into_filesize.md`)
Title: into filesize: Convert values to filesize format
Summary
The `into filesize` command in Nushell converts various data types (int, number, string, filesize) into a filesize format. It can be applied to individual values or to data structures like lists, records, and tables. The command takes a value as input and outputs the corresponding filesize representation, with the option to specify cell paths for data structure inputs.