Add Logic to Your Processing Pipelines
Use JavaScript expressions to compute values, set fallbacks, and branch logic — all inline in your processing steps.
Use the full power of JavaScript to compute values dynamically based on file properties.
Provide default values for missing metadata using standard JavaScript operators.
Apply different processing based on file size, type, dimensions, or any metadata field.
Build momentum
Make one workflow fit more files.
Adapt processing to each upload without building a separate service for every rule.
Ship custom workflows sooner
Use expressions to adapt processing settings to each file.
Keep outputs consistent
Calculate dimensions and other settings from source metadata.
Reduce manual decisions
Let file properties determine the processing rules you define.
Keep your backend simpler
Move file-specific calculations into your processing Template.
Reuse more of your setup
Handle different inputs with one adaptable Template.
Connect files to your product
Build output paths from file properties and your own metadata.
Dynamic File Processing
Use JavaScript expressions to create intelligent processing pipelines.
Dynamic dimensions
Calculate output dimensions based on input file properties.
"width": "${file.meta.width * (720 / file.meta.height)}"

Fallback values
Provide default values when file metadata is missing.
"title": "${file.meta.title || 'Untitled'}"

Conditional logic
Apply different processing based on file type, size, or any metadata field.
"resize_strategy": "${file.meta.width > file.meta.height ? 'fit' : 'pad'}"
Your workflow. Your controls.
Code evaluation without the pain
Stop duplicating processing rules across scripts. Keep file logic next to the steps it controls.
Calculate settings on the fly
Use JavaScript expressions in supported processing parameters.
Work with file metadata
Read properties such as dimensions and duration in your expressions.
Build meaningful filenames
Derive export paths and names from available variables.
Handle missing values
Define fallbacks in your expressions for metadata that a file may not contain.
Route files with custom rules
Combine expressions and file filters to choose the next processing step.
Reuse saved Templates
Keep processing instructions in one place for uploads and batch jobs.
Inspect processing results
Use Assembly status and errors to debug file-dependent behavior.
Keep your app in the loop
Get per-file callbacks with /http/request (alpha), or an Assembly Notification when processing ends.
Keep spending in check
Set a soft bill limit for alerts or a hard limit to stop processing.
Make your file workflows adapt
HIPAA-regulated workloads require a Business Associate Agreement.
Frequently asked questions
What does code evaluation do in a file workflow?
Dynamic evaluation lets JavaScript expressions calculate processing parameters from file properties and other available variables. For example, a resize width can depend on the original image dimensions. Start with the dynamic evaluation guide.
Do I need to deploy a separate JavaScript service?
No separate service is needed for supported expressions in Assembly Instructions. Transloadit evaluates them as part of processing. This is designed for file workflow logic, rather than hosting a general-purpose application. Read how the script Robot works.
Which file properties can my expressions use?
Use available Assembly Variables, including file metadata and your own user metadata where supported. Values vary with the input file and processing step, so provide fallbacks for optional fields. Explore Assembly Variables.
Can I use expressions to choose which files get processed?
Yes. Use expressions in a file filter to accept or decline files, then connect accepted files to the next steps. Simple array conditions are also available when you do not need JavaScript. See file filtering options.
Can I create filenames and storage paths dynamically?
Yes. Use available variables and expressions in supported path parameters to organize outputs by file properties or your application’s metadata. Check the export Robot’s path behavior for your storage provider. See S3 export options.
How is expression evaluation charged?
Simple Assembly Variable lookups are free. Expressions with logic or functions invoke the script run Robot and incur usage charges. Review the script Robot and its pricing.
How can I estimate and control costs?
Rates vary by operation and usage. Set a soft bill limit for alerts or a hard limit to stop processing. For larger workloads, ask about volume pricing and extra priority slots. Estimate your workflow costs.
