Bucket File Processor
Downloads a file from a bucket, processes it, and uploads the result.
bucket
Source
/**
* Demonstrates bucket nodes. Downloads a file, processes it,
* and uploads the result.
*/
webhook process_file {
label: "Process File"
schema: @json {
{
"type": "object",
"required": ["input_path"],
"properties": {
"input_path": { "type": "string" },
"output_path": { "type": "string" }
}
}
}
}
workflow file_pipeline {
label: "File Processing Pipeline"
root {
type: code
label: "Extract paths"
code: @ts { return context.nodes.root.input }
outputSchema: @json {
{
"type": "object",
"properties": {
"input_path": { "type": "string" },
"output_path": { "type": "string" }
}
}
}
}
node download {
type: bucket
label: "Download input file"
operation: download
path: @ts { return context.nodes.root.output.input_path }
}
node process {
type: code
label: "Process file content"
code: @ts {
const content = context.nodes.download.output
return {
processed: true,
original_path: context.nodes.root.output.input_path,
content: content
}
}
}
node upload {
type: bucket
label: "Upload result"
operation: upload
path: @ts {
return context.nodes.root.output.output_path || "processed/" + context.nodes.root.output.input_path
}
}
flow {
root -> download
download -> process
process -> upload
}
}
trigger on_file {
webhook:process_file -> file_pipeline
enabled: true
}
Flow
Trigger to workflow
process_filewebhook
file_pipeline
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Workflow nodes
CODE
Code Node
Extract paths
CODE
Code Node
Download input file
CODE
Code Node
Process file content
CODE
Code Node
Upload result
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.