Create Multi-GB ZIP Archives from URLs with JavaScript
Create multi-GB ZIP archives from remote URLs with JavaScript or React, split large output, and run the work with Eazip Cloud.
Use this workflow when the total archive size is too large for the memory and lifetime of a browser tab. Eazip Cloud fetches the remote URLs and creates the ZIP outside the visitor's device.
Before you start
- Get a public key.
- Add every source hostname to the Public App.
- Use remote URLs rather than browser
FileorBlobobjects. - Choose stream or stored.
Create the Cloud archive
import { createZip } from '@eazip/core';
export async function downloadLargeArchive(
urls: string[],
publicKey: string,
) {
const result = await createZip({
strategy: 'cloud',
publicKey,
files: urls,
zipName: 'media-export.zip',
mode: 'stored',
maxZipSizeBytes: 2_000_000_000,
});
result.downloadAll();
}import { useEazip, EazipTray } from '@eazip/react';
export function LargeArchiveButton({
urls,
publicKey,
}: {
urls: string[];
publicKey: string;
}) {
const zip = useEazip();
return (
<>
<button
disabled={zip.isBusy}
onClick={() =>
zip.download({
strategy: 'cloud',
publicKey,
files: urls,
zipName: 'media-export.zip',
mode: 'stored',
maxZipSizeBytes: 2_000_000_000,
})
}
>
Create ZIP archive
</button>
<EazipTray />
</>
);
}Use stored when the prepared archive will be downloaded more than once. Omit
mode to use the SDK's stream default. The public key is safe for browser
code; secret credentials are not.
Split large output
Set a practical part size for the people and systems receiving the export. The example above requests parts of approximately 2 GB:
zip.download({
strategy: 'cloud',
publicKey,
files: urls,
zipName: 'export.zip',
maxZipSizeBytes: 2_000_000_000,
});The result exposes one zips entry per part. A file larger than the cap remains
whole in its own oversized part. See Multi-ZIP splitting.
Keep the job across a reload
@eazip/react persists a created Cloud session and reconnects when the
application mounts again. Core applications must save the session handle and
call resumeZip() themselves.
Cloud progress is session-based
The browser SDK polls Cloud job state. It does not currently receive Local's per-file or byte progress, so show a processing state rather than a false percentage.
Plan for partial output
Large URL lists should expect an occasional unavailable source. Keep successful files unless the archive is invalid without every item:
zip.download({
strategy: 'cloud',
publicKey,
files: urls,
failOnUrlError: false,
});The tray reports a partial result and its skipped count. Cloud does not currently return the per-file error list exposed by Local jobs.
Check policy before changing code
| Symptom | Check |
|---|---|
| Session is rejected immediately | Public App file, size, mode, and origin policy |
| Job cannot fetch sources | Allowed source hosts, URL lifetime, and server-side reachability |
| Download is no longer available | Session and output expiry |
| Output is inconveniently large | maxZipSizeBytes and the receiving system's limits |
For jobs driven by URL count rather than total bytes, continue with Zip thousands of URLs with JavaScript. You can also read Sessions and resume or Download S3 or R2 objects as a ZIP.
Handle Failed Files and Partial ZIP Downloads
Keep successful files, inspect skipped URL errors, and decide when a JavaScript or React ZIP download should fail completely.
Zip Thousands of URLs with JavaScript
Package thousands of remote URLs with JavaScript and Eazip Cloud, with React code, partial results, and resumable job state.