# helia_edge.utils.file

## File Utility API

This module provides utility functions to interact with files.

**Functions**

| Name | Description |
| --- | --- |
| `download_file` | Download file from supplied url to destination streaming |
| `compute_checksum` | Compute checksum of file |
| `load_pkl` | Load pickled file |
| `save_pkl` | Save python objects into pickle file |
| `resolve_template_path` | Resolve templated path w/ supplied substitutions |

## helia_edge.utils.file.download_file

`function` · `python`

```python
download_file(src: str, dst: os.PathLike, progress: bool = True, chunk_size: int = 8192)
```

Download file from supplied url to destination streaming.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| src | str | Required | Source URL path |
| dst | PathLike | Required | Destination file path |
| progress | bool | True | Display progress bar. Defaults to True. |

Source: `helia_edge/utils/file.py:26`

## helia_edge.utils.file.compute_checksum

`function` · `python`

```python
compute_checksum(file: Path, checksum_type: str = 'md5', chunk_size: int = 8192) -> str
```

Compute checksum of file.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| file | Path | Required | File path |
| checksum_type | str | 'md5' | Checksum type. Defaults to "md5". |
| chunk_size | int | 8192 | Chunk size. Defaults to 8192. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
| str | str | Checksum value |

Source: `helia_edge/utils/file.py:49`

## helia_edge.utils.file.load_pkl

`function` · `python`

```python
load_pkl(file: str, compress: bool = True) -> dict[str, Any]
```

Load pickled file.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| file | str | Required | File path (.pkl) |
| compress | bool | True | If file is compressed. Defaults to True. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | dict[str, Any] | dict[str, Any]: Dictionary of pickled objects |

Source: `helia_edge/utils/file.py:69`

## helia_edge.utils.file.save_pkl

`function` · `python`

```python
save_pkl(file: str, compress: bool = True, **kwargs={})
```

Save python objects into pickle file.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| file | str | Required | File path (.pkl) |
| compress | bool | True | Whether to compress file. Defaults to True. |

Source: `helia_edge/utils/file.py:87`

## helia_edge.utils.file.resolve_template_path

`function` · `python`

```python
resolve_template_path(fpath: Path, **kwargs: Any = {}) -> Path
```

Resolve templated path w/ supplied substitutions.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| fpath | Path | Required | File path |
| **kwargs | Any | {} | Template arguments |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
| Path | Path | Resolved file path |

Source: `helia_edge/utils/file.py:102`
