> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Binary

*The Ingest Engine scalar functions are based on* [*Apache DataFusion*](https://arrow.apache.org/datafusion/) *and these docs are derived from the DataFusion function reference.*

| Function | Description | Example | Result |
| - | - | - | - |
| `encode(data, fmt)` | Encode to text | `encode('hello', 'base64')` | `'aGVsbG8='` |
| `decode(str, fmt)` | Decode from text | `decode('aGVsbG8=', 'base64')` | `'hello'` |
| `encode(data, 'hex')` | Encode to hex | `encode('hello', 'hex')` | `'68656c6c6f'` |

## `encode`

Encode binary data into a textual representation.

```
encode(expression, format)
```

**Arguments**

* **expression**: Expression containing string or binary data
* **format**: Supported formats are: `base64`, `hex`

**Related functions**: [decode](#decode)

## `decode`

Decode binary data from textual representation in string.

```
decode(expression, format)
```

**Arguments**

* **expression**: Expression containing encoded string data
* **format**: Same arguments as [encode](#encode)

**Related functions**: [encode](#encode)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.