Eazip
Concepts

Sessions and resume

Understand which Cloud credentials to retain and how to reconnect to a job after a reload.

Cloud jobs continue outside the browser tab. Once Eazip Cloud creates a session, your application can retain its session credentials and reconnect later.

Cloud only

Local jobs run inside the tab and cannot resume after it closes or reloads.

What should I save?

A Cloud ZipJob snapshot exposes session as soon as the server creates it:

const job = startZip({
  strategy: 'cloud',
  publicKey,
  files: urls,
});

const unsubscribe = job.subscribe(() => {
  const session = job.getSnapshot().session;
  if (session) {
    sessionStorage.setItem('eazip-session', JSON.stringify(session));
  }
});

try {
  await job.done;
} finally {
  unsubscribe();
}

Retain sessionId, clientSecret, and apiBaseUrl. Treat clientSecret as a credential: do not put it in a URL, analytics event, or log.

How do I resume the job?

Pass the saved credentials to resumeZip() after the reload:

import { resumeZip } from '@eazip/core';

const value = sessionStorage.getItem('eazip-session');
if (!value) throw new Error('No Eazip session found');

const saved = JSON.parse(value);
const job = resumeZip({
  sessionId: saved.sessionId,
  clientSecret: saved.clientSecret,
  apiBaseUrl: saved.apiBaseUrl,
});

const result = await job.done;
result.download();

The resumed job has the same snapshots, done promise, and download methods as a job returned by startZip().

What happens when polling stops?

Calling job.abort() stops this browser from polling; it does not cancel the server-side Cloud job. A later resumeZip() can reconnect while the session is valid.

Expired or revoked credentials cannot be resumed. Start a new export instead of retrying the old session.

React applications

@eazip/react persists resumable Cloud task metadata for you by default. See Persistence and reload-resume before building custom storage around the hook.

For sessions created by your own backend, see Backend-created sessions.