import { ZipWriter } from "https://dotland.deno.dev/x/zipjs@v2.7.53/index.d.ts";
Represents an instance used to create a zip file.
Examples
Here is an example showing how to create a zip file containing a compressed text file:
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();
Constructors
new
ZipWriter(writer: | WritableStream
Creates the ZipWriter instance
Methods
add<ReaderType>(): Promise<EntryMetaData>
filename: string,
reader?: ,
options?: ZipWriterAddDataOptions,
Adds an entry into the zip file
close(comment?: Uint8Array, options?: ZipWriterCloseOptions): Promise<Type>
Writes the entries directory, writes the global comment, and returns the content of the zip file