---
title: "Zip Archive for Video Projects | Rendley SDK Docs"
description: "Build and read .zip archives inside the FFmpeg virtual filesystem. Package video projects with all their assets for download or transfer."
url: https://docs.rendley.com/sdk/getting-started/zip-archive/
---

# Zip archive

The [ZipArchive](https://docs.rendley.com/sdk/api-reference/classes/ZipArchive.html) utility builds and reads `.zip` files inside the SDK’s FFmpeg virtual filesystem. Useful when you need to package multiple assets into a single download (for example: exporting a project with its thumbnails, or bundling a set of Lottie compositions with their images).

Info

Operations happen inside the FFmpeg virtual filesystem, not directly on `File` objects or `Blob`s. Use [FFmpeg.writeFile / readFile](https://docs.rendley.com/sdk/getting-started/ffmpeg/) to move data in and out.

## Create an archive

```
import { ZipArchive } from "@rendley/sdk";

const archive = new ZipArchive();
await archive.create("/tmp/my-project.zip");
```

`create(path)` initializes an empty archive at the given path in the FFmpeg filesystem.

## Open an existing archive

```
const archive = new ZipArchive();
await archive.open("/tmp/existing.zip");
```

## Add files

Two ways to add content:

- **`addFile(path, targetDirectory?)`**: add a file that already exists in the FFmpeg filesystem.
- **`addData(path, data, takeOwnership?)`**: add a `Uint8Array` directly. Set `takeOwnership` to `true` to skip copying the buffer (the archive will reuse it).
- **`addFiles(paths[], targetDirectory?)`**: add multiple files in one call.

```
const ffmpeg = Engine.getInstance().getFFmpeg();
await ffmpeg.writeFile("/tmp/thumbnail.png", pngBytes);

await archive.addFile("/tmp/thumbnail.png");
await archive.addData(
  "/project.json",
  new TextEncoder().encode(JSON.stringify(state)),
);
```

## Extract

- **`extractAll(path)`**: extract every entry into the given directory.
- **`extractFile(fromPath, toPath)`**: extract a single entry.
- **`readFile(path)`**: read an entry’s contents as a `Uint8Array` without writing it to disk.

```
await archive.extractAll("/tmp/output");
const json = await archive.readFile("/project.json");
```

## List contents

```
const paths = await archive.listFiles();
```

## Save and close

Call `save()` to flush pending writes. Use `destroy()` to release resources when you’re done.

```
await archive.save();
await archive.destroy();
```

## Downloading the result

After `save()`, download the file:

```
const ffmpeg = Engine.getInstance().getFFmpeg();
await ffmpeg.downloadFile("/tmp/my-project.zip");
```

## What to read next

- **[FFmpeg in the browser](https://docs.rendley.com/sdk/getting-started/ffmpeg/)** runs the WASM build for the conversions the engine does not cover.
- API reference: [`ZipArchive`](https://docs.rendley.com/sdk/api-reference/classes/ZipArchive.html).

[Previous pageSave and restore](https://docs.rendley.com/sdk/getting-started/save-restore/) [Next pageUndo and redo](https://docs.rendley.com/sdk/getting-started/undo-redo/)
