Class ZipWriter<Type>

Represents an instance used to create a zip file.

Example

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

// use a BlobWriter to store with a ZipWriter the zip into a Blob object
const blobWriter = new zip.BlobWriter("application/zip");
const writer = new zip.ZipWriter(blobWriter);

// use a TextReader to read the String to add
await writer.add("filename.txt", new zip.TextReader("test!"));

// close the ZipReader
await writer.close();

// get the zip file as a Blob
const blob = await blobWriter.getData();

Type Parameters

  • Type

Constructors

Properties

Methods

Constructors

Properties

hasCorruptedEntries?: boolean

true if the zip contains at least one entry that has been partially written.

Methods

  • Writes the entries directory, writes the global comment, and returns the content of the zip file

    Parameters

    • Optional comment: Uint8Array

      The global comment of the zip file.

    • Optional options: ZipWriterCloseOptions

      The options.

    Returns Promise<Type>

    The content of the zip file.

Generated using TypeDoc