# file

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: file
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: outputs/file
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: outputs/file.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/outputs/file.adoc
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/outputs/file.md -->

**Type:** Output ▼

[Output](https://docs.redpanda.com/connect/components/outputs/file/)[Cache](https://docs.redpanda.com/connect/components/caches/file/)[Input](https://docs.redpanda.com/connect/components/inputs/file/)

**Available in:** Self-Managed

Writes messages to files on disk based on a chosen codec.

#### Common

```yml
outputs:
  label: ""
  file:
    path: "" # No default (required)
    codec: lines
```

#### Advanced

```yml
outputs:
  label: ""
  file:
    path: "" # No default (required)
    codec: lines
```

Messages can be written to different files by using [interpolation functions](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries) in the path field. However, only one file is ever open at a given time, and therefore when the path changes the previously open file is closed.

## [](#fields)Fields

### [](#codec)`codec`

The way in which the bytes of messages should be written out into the output data stream. It’s possible to write lines using a custom delimiter with the `delim:x` codec, where x is the character sequence custom delimiter.

Requires version 3.33.0 or later.

**Type**: `string`

**Default**: `lines`

| Option | Summary |
| --- | --- |
| all-bytes | Only applicable to file based outputs. Writes each message to a file in full, if the file already exists the old content is deleted. |
| append | Append each message to the output stream without any delimiter or special encoding. |
| lines | Append each message to the output stream followed by a line break. |
| delim:x | Append each message to the output stream followed by a custom delimiter. |

```yaml
# Examples:
codec: lines

# ---

codec: delim:

# ---

codec: delim:foobar
```

### [](#path)`path`

The file to write to, if the file does not yet exist it will be created. This field supports [interpolation functions](https://docs.redpanda.com/connect/configuration/interpolation/#bloblang-queries).

Requires version 3.33.0 or later.

**Type**: `string`

```yaml
# Examples:
path: /tmp/data.txt

# ---

path: /tmp/${! timestamp_unix() }.txt

# ---

path: /tmp/${! json("document.id") }.json
```