Flows/File Operations

File & Folder Operations

Manage files and folders in your cloud storage. Upload, download, move, copy, archive and more.

Read & Get Files

Get File
Download a file by ID

Retrieves a file by its ID from Serenities Drive. Choose output format based on how you need to use the file downstream.

Output Format Options:

  • Binary: Binary data reference for file operations
  • Base64: Base64-encoded string for APIs/embedding

Output:

{
  "fileId": "abc123",
  "fileName": "report.pdf",
  "mimeType": "application/pdf",
  "fileSize": 1024000,
  "__type": "binary" // or "base64"
}
Read File
Extract text content from files

Reads and extracts text content from various file formats including PDF, DOCX, XLSX, CSV, JSON, TXT, and more. Supports multiple input sources.

Input Sources:

  • File ID: Read from Serenities Drive by file ID
  • Base64: Read from base64-encoded string
  • Binary: Read from binary data reference

Supported Formats:

PDF, DOCX, XLSX, TXT, JSON, CSV, XML, Markdown, HTML, YAML, LOG files

Output:

{
  "content": "Extracted text content...",
  "fileName": "document.pdf",
  "mimeType": "application/pdf",
  "format": "pdf",
  "metadata": { "pages": 5 }
}
Get File Info
Get file metadata without downloading

Returns file metadata (name, size, type, dates) without downloading the actual file content. Useful for checking files before processing.

Output:

{
  "id": "abc123",
  "name": "video.mp4",
  "mimeType": "video/mp4",
  "size": 52428800,
  "createdAt": "2025-01-15T10:30:00Z",
  "updatedAt": "2025-01-15T10:30:00Z",
  "folderId": "folder123"
}
List Files
Get all files in a folder

Returns a list of all files in a folder. Use with Iterator to process each file individually.

Common Pattern: Process All Files

List FilesIteratorProcess Each
# Configuration
Folder ID: {{#1.folderId}}
Filter: *.pdf
Limit: 100

Create & Upload

Create File
Create a new file from text content

Creates a new file with the specified content. Perfect for generating reports, exports, or processed data outputs.

# Example: Create JSON export
File Name: export_{{nowDate}}.json
Content: {{#2.data.toJsonString()}}
Folder: exports

Tip: Use {{nowDate}} or {{nowDateTime}} in file names to create unique, timestamped files.

Upload File
Upload binary data as a file

Uploads binary data (from HTTP response, another file, etc.) as a new file. Preserves file type and encoding.

Example: Download and Upload

HTTP RequestUpload File

Download image from URL, then upload to your storage

# Configuration
Binary Data: {{#2.body}}
File Name: {{#2.headers.content-disposition}}
MIME Type: {{#2.headers.content-type}}
Convert File
Convert file between formats

Converts files between different formats (e.g., image formats, document formats). Supports common conversions.

Supported Conversions:

PNG → JPG, WEBP
JPG → PNG, WEBP
CSV → JSON
JSON → CSV

Move & Copy

Copy File
Create a copy of a file

Creates a copy of a file in the same or different folder. Optionally rename the copy.

# Example: Backup file before processing
Source File: {{#1.fileId}}
Destination: backups/
New Name: backup_{{nowDate}}_{{#1.fileName}}
Move File
Move a file to another folder

Moves a file to a different folder. The original file is removed from its current location.

# Example: Move processed files
File ID: {{iterator.item.id}}
Destination: processed/
Rename File
Change a file's name

Renames a file without changing its location.

Delete File
Permanently delete a file

Permanently removes a file. This action cannot be undone.

Archive & Extract

Server-Only: Archive and Unarchive utilities run on the server and may not be available in all execution contexts due to their dependencies on server-side libraries.

Archive
Create ZIP archive from files

Creates a ZIP archive containing multiple files. Perfect for bundling exports or creating backups.

Example: Archive all PDFs in folder

List FilesFilter *.pdfArchive
# Configuration
Archive Name: reports_{{nowDate}}.zip
File IDs: {{#2.files}}
Output Folder: archives/
Unarchive
Extract files from ZIP archive

Extracts all files from a ZIP archive. Files are placed in the specified output folder.

# Configuration
Archive File: {{#1.fileId}}
Output Folder: extracted/
Filter: *.csv (optional)

Folder Operations

Create Folder
Create a new folder

Creates a new folder at the specified location. Can create nested paths (e.g., "reports/2025/january").

# Example: Create dated folder
Folder Name: exports/{{nowDate}}
Parent: root
List Folders
Get all folders in a location

Returns a list of all subfolders in a folder. Use with Iterator to process folders recursively.

Copy Folder

Copy folder and all contents

Move Folder

Move folder to new location

Delete Folder

Delete folder and contents

Common Patterns

Batch Process Files

List FilesIteratorRead FileProcessMove to Done

List all files, iterate through each, process, then move to a "processed" folder.

Generate & Export Report

Query DataSet VariableCreate File

Query database, format as CSV/JSON, save to timestamped file.

File Operations - Flows Guide - Serenities