# Chalk Python SDK Reference: Bytes Functions
source: https://docs.chalk.ai/api-docs#section-bytes-functions

## `bytes_to_string(expr, encoding)`
source: https://docs.chalk.ai/api-docs#bytes_to_string

Convert bytes to a string using the specified encoding.

**Parameters**

- `expr`: `Any`
  A bytes feature to convert to a string.
- `encoding`: `'utf-8' | 'hex' | 'base64'`
  The encoding to use when converting the bytes to a string.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class User:
   id: str
   name: str
   hashed_name: bytes
   decoded_name: str = F.bytes_to_string(_.hashed_name, encoding="utf-8")
```

## `from_big_endian_64(expr)`
source: https://docs.chalk.ai/api-docs#from_big_endian_64

Convert a 64-bit big-endian bytes value to an integer.

**Parameters**

- `expr`: `Any`
  A bytes feature to convert.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class ByteData:
   id: str
   raw_bytes: bytes
   value: int = F.from_big_endian_64(_.raw_bytes)
```

## `from_big_endian_32(expr)`
source: https://docs.chalk.ai/api-docs#from_big_endian_32

Convert a 32-bit big-endian bytes value to an integer.

**Parameters**

- `expr`: `Any`
  A bytes feature to convert.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class ByteData:
   id: str
   raw_bytes: bytes
   value: int = F.from_big_endian_32(_.raw_bytes)
```

## `gunzip(expr)`
source: https://docs.chalk.ai/api-docs#gunzip

Decompress a GZIP-compressed bytes feature.

**Parameters**

- `expr`: `Underscore`
  The GZIP-compressed bytes feature to decompress.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class User:
   id: str
   compressed_data: bytes
   decompressed_data: bytes = F.gunzip(_.compressed_data)
```

## `from_snappy(expr)`
source: https://docs.chalk.ai/api-docs#from_snappy

Decompress a snappy compressed bytes feature.

**Parameters**

- `expr`: `Underscore`
  The snappy compressed bytes feature to decompress.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class User:
   id: str
   compressed_data: bytes
   decompressed_data: bytes = F.from_snappy(_.compressed_data)
```
