Represents a Filesystem instance.

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));

Hierarchy (View Summary)

Constructors

Properties

children: ZipEntry[]

The children of the entry.

The underlying EntryMetaData instance.

directory: true

true for ZipDirectoryEntry instances.

id: number

The ID of the instance.

name: string

The relative filename of the entry.

parent?: ZipEntry

The parent directory of the entry.

The root directory.

uncompressedSize: number

The uncompressed size of the content.

Methods

  • Creates a zip file via a custom Writer instance containing the entry and its descendants

    Parameters

    Returns Promise<unknown>

    A promise resolving to the data.