Eazip
Getting Started

JavaScript

Learn the basic @eazip/core workflow: create, observe, and download ZIP jobs in any browser application.

@eazip/core is Eazip's framework-agnostic browser engine. Use it with your own interface in any application that provides fetch and Blob.

1. Install

npm install @eazip/core

Local is the default

Without a strategy, Eazip creates the ZIP in the browser. No account, API key, file upload, or backend code is required.

2. Create and download a ZIP

Given a file input and button in your interface:

index.html
<input id="files" type="file" multiple />
<button id="download">Download ZIP</button>

Call createZip(...), wait for the result, then download it:

app.js
import { createZip } from '@eazip/core';

const fileInput = document.querySelector('#files');
const downloadButton = document.querySelector('#download');

downloadButton.addEventListener('click', async () => {
  const result = await createZip({
    files: fileInput.files,
    zipName: 'export.zip',
  });

  result.download();
});
  • createZip(...) is the simplest path and resolves when the ZIP is ready.
  • files is the content to package; zipName names the download.
  • result.download() starts the browser download.

3. Pass files or URLs

The same files option accepts:

  • browser File, FileList, and Blob objects;
  • URL strings such as https://assets.example.com/hero.png;
  • { file, filename } or { url, filename } when you need to control the path inside the ZIP.

You can mix these shapes in one array. Remote URLs used by Local jobs must allow browser requests; see Inputs and sources.

4. Track progress or cancel

Use startZip(...) when your interface needs access to the job while it is running:

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

const job = startZip({
  files: fileInput.files,
  zipName: 'export.zip',
});

const unsubscribe = job.subscribe(() => {
  const { status, progress } = job.getSnapshot();
  console.log(status, progress);
});

try {
  const result = await job.done;
  result.download();
} finally {
  unsubscribe();
}

Call job.abort() from your cancel action. If an individual URL fails, Eazip returns the other files as a partial result by default; inspect result.errors for the skipped files.

5. Move larger URL jobs to Cloud

For multi-gigabyte archives, thousands of URLs, or jobs that must survive a reload, keep the same function and change the execution strategy:

const result = await createZip({
  strategy: 'cloud',
  publicKey: 'pk_ez_...',
  files: urls,
});

result.download();

Cloud jobs accept remote URLs rather than browser File or Blob objects. Read When to use Eazip Cloud before configuring a public key.

Next steps