File
Purpose
Section titled “Purpose”The File Operator enables creating and managing files within the system. It provides functionality for converting text content to files and downloading files from URLs, making them available for further processing within the application.
Use Cases
Section titled “Use Cases”- Converting text or JSON data to files
- Downloading files from external URLs
- Creating temporary files for processing
- Storing generated content as files
- Preparing data for export or download
- Creating files from API responses
- Storing configuration data as files
Supported Operations
Section titled “Supported Operations”as-file
Section titled “as-file”Converts text content to a file with the given name and content type.
Input Parameters
Section titled “Input Parameters”name
(string): The name to give to the created filecontentType
(string): The MIME type of the file (e.g., “text/plain”, “application/json”)content
(string): The text content to be stored in the file
Output
Section titled “Output”Returns an object containing information about the created file, including:
id
(string): The unique identifier of the filename
(string): The file namecontentType
(string): The content type of the filesize
(long): The file size in bytesorganizationId
(string): The organization ID associated with the file
Example
Section titled “Example”{ "name": "config.json", "contentType": "application/json", "content": "{\"key\": \"value\", \"enabled\": true}"}
from-url
Section titled “from-url”Downloads a file from the specified URL and stores it in the system.
Input Parameters
Section titled “Input Parameters”url
(string): The URL to download the file fromcontentType
(string, optional): The MIME type of the file. If not provided, the system will attempt to determine the content type from the downloaded content.
Output
Section titled “Output”Returns a FileDto
object containing information about the downloaded file, including:
id
(string): The unique identifier of the filename
(string): The file name (derived from the URL path)contentType
(string): The content type of the filesize
(long): The file size in bytesorganizationId
(string): The organization ID associated with the file
Example
Section titled “Example”{ "url": "https://example.com/documents/report.pdf", "contentType": "application/pdf"}
- If the content type is not specified and cannot be determined automatically, “application/octet-stream” will be used as the default.
- The file name is extracted from the last segment of the URL path.
- The system handles the download process and stores the file content securely.