File
Unzip (Extract ZIP)
Use the unzipAsync and unzipSync methods to extract the contents of a ZIP file into a destination namespace/folder.
This is useful for expanding uploaded archives directly into your storage.
trelae.unzipAsync(options) → { status, operationId, source, meta }
Enqueue a ZIP extraction job. Returns immediately with:
status— always"queued"operationId— string ID for tracking/pollingsource—Fileinstance pointing to the source ZIPmeta— raw metadata:meta.source→{ id, name, location, namespaceId }meta.dest→{ namespaceId, location }
Example
trelae.getUnzipStatus(operationId) → { id, type, status }
Fetch the current status of an async UNZIP job.
Possible statuses: "queued", "processing", "completed", "failed".
Example
trelae.unzipSync(options) → { status, operationId, source, meta }
Convenience wrapper: enqueues an extraction and polls until it is "completed" (or fails/timeout).
Returns the same source File instance and the enqueue meta for correlation.
Example
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
fileId | string | ✅ | Source ZIP file id |
namespaceId | string | ✅ | Destination namespace for extracted contents |
location | string | ❌ | Folder path inside the destination namespace (default: root) |
poll | object | ❌ | For unzipSync: { intervalMs, timeoutMs } |
Returns
status—"queued"forunzipAsync,"completed"forunzipSyncoperationId— string for correlating logs/ops and pollingsource—Fileinstance pointing to the source ZIPmeta— enqueue-time metadata withsourceanddest
Notes
- The source ZIP file must be accessible to your API key’s namespace permissions.
- For large archives, prefer
unzipAsync+getUnzipStatusor useunzipSyncif you want to block until completion. - Extraction preserves internal paths contained in the ZIP and writes them under
dest.locationin the destination namespace. - After completion, extracted files behave like any other files in Trelae: list, move, copy, or delete as needed.
