Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/zipjs/index.d.ts>FS

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
Go to Latest
class FS
import { FS } from "https://deno.land/x/zipjs@v2.6.77/index.d.ts";

Represents a Filesystem instance.

Examples

Here is an example showing how to create and read a zip file containing a compressed text file:

const TEXT_CONTENT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.";
const FILENAME = "lorem.txt";
const BLOB = new Blob([TEXT_CONTENT], { type: zip.getMimeType(FILENAME) });
let zipFs = new zip.fs.FS();
zipFs.addBlob("lorem.txt", BLOB);
const zippedBlob = await zipFs.exportBlob();
zipFs = new zip.fs.FS();
await zipFs.importBlob(zippedBlob);
const firstEntry = zipFs.children[0];
const unzippedBlob = await firstEntry.getBlob(zip.getMimeType(firstEntry.name));

Properties

The root directory.

Methods

find(fullname: string): ZipEntry | undefined

Returns a ZipEntry instance from its full filename

getById(id: number): ZipEntry | undefined

Returns a ZipEntry instance from the value of ZipEntry#id

move(entry: ZipEntry, destination: ZipDirectoryEntry): void

Moves a ZipEntry instance and its children into a ZipDirectoryEntry instance

remove(entry: ZipEntry): void

Removes a ZipEntry instance and its children