ZIP jobs
Choose createZip or startZip and understand the lifecycle shared by Local and Cloud execution.
Use createZip when you only need the finished result, and startZip when you
need the running job. Both produce the same ZipJob lifecycle, Local or Cloud.
Which function should I use?
| Need | Use | Returns |
|---|---|---|
| Wait for a ZIP, then download it | createZip(options) | Promise<ZipResult> |
| Show progress, cancel, or drive custom UI | startZip(options) | ZipJob immediately |
createZip(options) is the one-shot form of startZip(options).done, and both
accept the same options.
const result = await createZip({ files });
result.download();What is the lifecycle?
A job starts in starting, moves to processing, then settles on one terminal
status:
| Status | Meaning |
|---|---|
completed | Every source produced usable output. |
partial | Output is usable, but one or more sources were skipped. |
failed | No usable result was produced. |
aborted | This client stopped the job. |
Snapshots also expose progress, output ZIPs, errors, and Cloud session metadata when those values exist.
How do I observe a job?
const job = startZip({ files });
const unsubscribe = job.subscribe(() => {
const snapshot = job.getSnapshot();
console.log(snapshot.status, snapshot.progress);
});
try {
const result = await job.done;
result.download();
} finally {
unsubscribe();
}Three members cover most custom interfaces:
| Member | Behavior |
|---|---|
getSnapshot() | Returns the current immutable state. |
subscribe(listener) | Runs the listener after each state change. |
done | Resolves with a completed or partial result. |
What does abort mean?
For a Local job, abort() stops browser fetching and ZIP creation. For a Cloud
job, it only stops this client from polling — the server-side job can continue
and be resumed later.
What should I do with the result?
Use download() for one output, or downloadAll() when the job was
split into multiple ZIPs. Local results also expose
dispose(), which revokes their temporary object URLs once you are done.
See the Core Reference for every option, member, result field, and error class.