## utils.calc_part_size()

<span id="hexkit.utils.calc_part_size"></span>


Gives recommendations on the part_size to use for up- or download of a file given


Usage

``` python
utils.calc_part_size(
    *,
    file_size,
    preferred_part_size=None,
)
```


it's total size. It makes sure that chosen part size is within bounds and produces \<= 10_000 parts. Args: file_size (int): total file size in bytes preferred_part_size (int): You may provide your preferred part size in bytes. If it satisfies the technical constraints, it will be returned unchanged. Otherwise, it is ignored and a technically viable part size is chosen instead.


## Returns


`int: int`  
a recommendation for the part size in bytes


## Raises


`ValueError`  
if file size exceeds the maximum of 5 TiB
