# Files Helper

The Files Helper piece in ZBrain Flow provides essential file management capabilities for your workflows. This versatile component allows you to read, create, and manipulate files within your automations. With Files Helper, you can process file contents, generate new files with custom data, convert file encodings, and verify file types - all crucial operations when building workflows that involve document processing, data transformation, or content generation.

### **How to Use Files Helper in ZBrain Flow?** <a href="#how-to-use-files-helper-in-zbrain-flow" id="how-to-use-files-helper-in-zbrain-flow"></a>

* Click on the '+' button in the Flow and search for Files Helper.
* Select Files Helper.
* Decide on the action you need, then select it. ZBrain Flow provides several options:
  * **Read File** – Reads content from an existing file.
  * **Create File** – Generates a new file with specified content.
  * **Change File Encoding** – Converts a file from one encoding format to another.
  * **Check File Type** – Analyzes a file to determine its MIME type and optionally filter by type.

### **How to Read a File?** <a href="#how-to-read-a-file" id="how-to-read-a-file"></a>

**Step 1: Select File**

* Use the ‘File’ field to add the file you want to read.

**Step 2: Choose Output Format**

* From the ‘Output format’ dropdown, select how you want the file content to be returned:
  * **Text -** Returns the content as plain text.
  * **Base64 -** Returns the content encoded in Base64 format.

### **How to Create a File?** <a href="#how-to-create-a-file" id="how-to-create-a-file"></a>

**Step 1: Specify Content**

* In the ‘Content’ field, enter or paste the data you want to include in the file.

**Step 2: Set File Name**

* Enter the desired ‘File name’ for your new file.

**Step 3: Choose Encoding**

* From the ‘Encoding’ dropdown, select the character encoding for your file. The default is UTF-8, which works well for most text-based files.

### **How to Change File Encoding?** <a href="#how-to-change-file-encoding" id="how-to-change-file-encoding"></a>

**Step 1: Select Source File**

* Use the ‘Source file’ field to add the file whose encoding you want to change.

**Step 2: Specify Source Encoding**

* From the ‘Source encoding’ dropdown, select the current encoding (e.g., UTF-16LE ) of your file.

**Step 3: Set Output File Name**

* Enter the desired ‘Output file name’ for the converted file. You can use the same name as the source file or create a new name.

**Step 4: Choose Output Encoding**

* From the ‘Output encoding’ dropdown, select the target encoding format (e.g., Binary).

### **How to Check File Type?** <a href="#how-to-check-file-type" id="how-to-check-file-type"></a>

**Step 1: Add File**

* Use the ‘File to Check’ field to add the file you want to analyze.

**Step 2: Specify MIME Types**&#x20;

* From the ‘Select MIME Types’ dropdown, choose specific file types to match against. You can select multiple MIME types to filter for specific formats.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zbrain.ai/zbrain-documentation/zbrain-builder/flows/flow-components/files-helper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
