Archive
Bundle multiple files into one downloadable archive (ZIP or tar.gz). It is media-agnostic — inputs can mix types.
File-first — the short path
files([...]).archive(...) bundles the inputs into one archive and hides the
multi-input wiring. Both the format and folder structure are optional — the
server defaults to ZIP + flat. Archive is terminal: the archive is the final
artifact, so there is no chain after it.
- TypeScript
- PHP
- Python
- Rust
const result = await client
.files(['./report.pdf', './hero.jpg', './narration.mp3'])
.archive({ format: 'zip' })
.run({ maxWait: '5m' });
await result.toFile('bundle.zip');
use Gisl\Sdk\Ergonomic\ArchiveFormat;
use Gisl\Sdk\Ergonomic\ArchiveRecipeOptions;
$result = $client->files(['./report.pdf', './hero.jpg', './narration.mp3'])
->archive(new ArchiveRecipeOptions(format: ArchiveFormat::Zip))
->run(maxWait: '5m');
$result->toFile('bundle.zip');
Coming soon.
Coming soon.
For large bundles, use submit() instead of run() (fire-and-forget; returns a
handle you wait on later), exactly like merge.
Compress, then bundle
A common flow compresses each file first, then archives the compressed outputs. Give each file its own compress step and archive the results — the file-first chain wires the job graph for you.
The low-level form
If you need the raw workflow, archive is a multi-input operation: the archive
job references several sources via its inputs[]. A multi-input source must be a
job_output (or an external import / connection) — it cannot be a raw upload
directly. So to bundle uploaded files, wrap each upload in a passthrough source
job and reference that job's output.
// one passthrough source job per upload, then the archive job that consumes them
$sourceJobs = [];
$inputs = [];
foreach ($uploads as $i => $upload) {
$srcId = "src_{$i}";
$sourceJobs[] = new JobDefinitionPayload(
operations: [new OperationDef(type: 'passthrough')],
id: $srcId,
source: Sources::upload($upload->getFileId()),
);
$inputs[] = ['source' => Sources::jobOutput($srcId)];
}
$bundleJob = new JobDefinitionPayload(
operations: [new OperationDef(type: 'archive', options: [
'format' => 'zip',
'folder_structure' => 'flat',
])],
id: 'bundle',
inputs: $inputs,
);
$created = $client->createWorkflow(new WorkflowCreatePayload(
jobs: [...$sourceJobs, $bundleJob],
));