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/polling
  • source — File instance pointing to the source ZIP
  • meta — 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

NameTypeRequiredDescription
fileIdstring✅Source ZIP file id
namespaceIdstring✅Destination namespace for extracted contents
locationstring❌Folder path inside the destination namespace (default: root)
pollobject❌For unzipSync: { intervalMs, timeoutMs }

Returns

  • status — "queued" for unzipAsync, "completed" for unzipSync
  • operationId — string for correlating logs/ops and polling
  • source — File instance pointing to the source ZIP
  • meta — enqueue-time metadata with source and dest

Notes

  • The source ZIP file must be accessible to your API key’s namespace permissions.
  • For large archives, prefer unzipAsync + getUnzipStatus or use unzipSync if you want to block until completion.
  • Extraction preserves internal paths contained in the ZIP and writes them under dest.location in the destination namespace.
  • After completion, extracted files behave like any other files in Trelae: list, move, copy, or delete as needed.