The File block is a built-in Zoen block for working with files stored in the workspace, or fetched from external URLs. It handles reading, writing, appending, compressing, decompressing, and sharing files as part of a workflow.
With the File block, you can:
- Read and extract content: Load workspace file objects and extract their text content
- Fetch from URLs: Retrieve and parse files from external URLs with custom headers
- Write and append: Create new workspace files or append content to existing ones
- Compress and decompress: Bundle files into a .zip archive or extract an archive into the workspace
- Manage sharing: Enable or disable a public share link for a file, with public, password, email, or SSO access modes
In Zoen, the File block allows your agents to read and extract text from workspace files, fetch and parse files from URLs, write or append content to files, bundle files into or out of .zip archives, and control public sharing access for a file—all programmatically as steps in a workflow. This makes it possible to move file content into and out of a workflow, package outputs for download or transfer, and expose files to external users through a managed share link.
Read workspace file objects, extract the text content of files, fetch and parse files from URLs with optional headers, write new workspace files, append content to existing files, compress files into a .zip archive, extract a .zip archive into the workspace, or manage the public share link for a file.
| Parameter | Type | Required | Description |
|---|
fileId | string | No | Canonical workspace file ID, or an array of canonical workspace file IDs. |
fileInput | file | No | Selected workspace file object. |
| Parameter | Type | Description |
|---|
files | file[] | Workspace file objects |
Extract the text content of one or more workspace files from selected file objects or canonical workspace file IDs.
| Parameter | Type | Required | Description |
|---|
fileId | string | No | Canonical workspace file ID, or an array of canonical workspace file IDs. |
fileInput | file | No | Selected workspace file object, or an array of file objects. |
| Parameter | Type | Description |
|---|
contents | array | Array of file text contents, one entry per file in input order |
Fetch and parse a file from a URL with optional custom headers.
| Parameter | Type | Required | Description |
|---|
headers | object | No | HTTP headers to include when fetching URL-based files. |
| Parameter | Type | Description |
|---|
files | file[] | Fetched files as UserFile objects |
combinedContent | string | Combined content of all fetched files |
Create a new workspace file. If a file with the same name already exists, a numeric suffix is added (e.g., "data (1).csv").
| Parameter | Type | Required | Description |
|---|
fileName | string | Yes | File name (e.g., "data.csv"). If a file with this name exists, a numeric suffix is added automatically. |
content | string | Yes | The text content to write to the file. |
contentType | string | No | MIME type for new files (e.g., "text/plain"). Auto-detected from file extension if omitted. |
| Parameter | Type | Description |
|---|
id | string | File ID |
name | string | File name |
size | number | File size in bytes |
url | string | URL to access the file |
Append content to an existing workspace file. The file must already exist. Content is added to the end of the file.
| Parameter | Type | Required | Description |
|---|
fileName | string | Yes | Name of an existing workspace file to append to. |
content | string | Yes | The text content to append to the file. |
| Parameter | Type | Description |
|---|
id | string | File ID |
name | string | File name |
size | number | File size in bytes |
url | string | URL to access the file |
Compress one or more workspace files into a single .zip archive stored in the workspace, for bundling files to download, transfer, or store.
| Parameter | Type | Required | Description |
|---|
fileId | string | No | Canonical workspace file ID, or an array of canonical workspace file IDs. |
fileInput | file | No | Selected workspace file object, or an array of file objects. |
archiveName | string | No | Name for the .zip archive (e.g., "documents.zip"). Defaults to the source file name when compressing a single file, otherwise "archive.zip". |
| Parameter | Type | Description |
|---|
id | string | Compressed archive file ID |
name | string | Compressed archive file name |
size | number | Compressed archive size in bytes |
url | string | URL to access the compressed archive |
files | file[] | Compressed archive file object, as a single-item array |
Extract the contents of a .zip archive into the workspace, preserving the archive folder structure.
| Parameter | Type | Required | Description |
|---|
fileId | string | No | Canonical workspace file ID of the .zip archive to extract. |
fileInput | file | No | Selected .zip archive file object. |
| Parameter | Type | Description |
|---|
files | file[] | Extracted workspace file objects |
Enable or disable the public share link for a workspace file, and set its access mode (public, password, email, or SSO). Idempotent: the public link stays stable across changes.
| Parameter | Type | Required | Description |
|---|
fileId | string | No | Canonical ID of the workspace file to update sharing for. |
fileInput | file | No | Selected workspace file object (from the file picker). |
isActive | boolean | Yes | Whether the public link is enabled. Set to false to make the file private. |
authType | string | No | Access mode for the link: "public", "password", "email", or "sso". Defaults to "public". |
password | string | No | Password to protect the link. Required when authType is "password". |
allowedEmails | array | No | Allowed emails or "@domain" patterns. Required when authType is "email" or "sso". |
| Parameter | Type | Description |
|---|
url | string | Public share URL for the file |
isActive | boolean | Whether the public link is enabled |
authType | string | Access mode: public, password, email, or sso |
hasPassword | boolean | Whether the share is password-protected |
allowedEmails | array | Allowed emails/domains for email or SSO access |