File
Zip Multiple Files
Use the zipAsync
and zipSync
methods to bundle multiple files into a single ZIP archive stored in a destination namespace.
This is useful for downloading, sharing, or archiving multiple assets in one file.
trelae.zipAsync(options)
→ { status, operationId, file, meta }
Enqueue a ZIP creation job. Returns immediately with:
status
— always"queued"
operationId
— string ID for trackingfile
— placeholderFile
instancemeta
— raw metadata for the placeholder file
Use this when you don’t want to block until the ZIP is ready.
Example
trelae.getZipStatus(operationId)
→ { id, type, status }
Fetch the current status of an async ZIP job.
Possible statuses: "queued"
, "processing"
, "completed"
, "failed"
.
Example
trelae.zipSync(options)
→ { status, operationId, file, meta }
Convenience wrapper: enqueues a ZIP and polls until it is "completed"
.
Returns once the ZIP is uploaded and ready.
Example
Parameters
Name | Type | Required | Description |
---|---|---|---|
fileIds | string[] | ✅ | Array of file IDs to include in the archive |
namespaceId | string | ✅ | Namespace where the ZIP will be stored |
zipName | string | ❌ | Custom name for the ZIP (default: auto-generated) |
location | string | ❌ | Folder path inside the namespace (default: root) |
poll | object | ❌ | For zipSync : { intervalMs, timeoutMs } |
Notes
- All files in
fileIds
must be accessible to your API key’s namespace permissions. - For large or many files, prefer
zipAsync
+getZipStatus
orzipSync
to handle long-running jobs. - Once completed, the ZIP behaves like any other file in Trelae: it can be downloaded, moved, copied, or deleted.