Appearance
Class: ZipWriter ​
Constructors ​
Constructor ​
new ZipWriter():
ZipWriter
Returns ​
ZipWriter
Methods ​
add() ​
add(
path,data,opts?):void
Add a package part.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
path | string | full zip path, e.g. ppt/slides/slide1.xml |
data | string | Uint8Array<ArrayBufferLike> | XML string (UTF-8 encoded) or already-decoded bytes (media) |
opts? | { store?: boolean; } | - |
opts.store? | boolean | skip DEFLATE for this entry (already-compressed media) |
Returns ​
void
entries() ​
entries():
object[]
Snapshot the accumulated entries in insertion order, before zipping. Each entry carries its already-encoded bytes and whether it was added with store (recovered from the per-entry level). This is the seam the package-parts path reads: the same accumulator generate would zip, exposed without running DEFLATE. Every value in #entries is the [bytes, opts] tuple add writes, so the cast is total.
Returns ​
object[]
generate() ​
generate(
type,opts):Promise<string|ArrayBuffer|Uint8Array<ArrayBufferLike> |Blob>
Finalize the archive in the requested output shape.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
type | "arraybuffer" | "blob" | "base64" | "binarystring" | "nodebuffer" | "uint8array" | one of the supported ZIP_OUTPUT_TYPE output shapes |
opts | { compression: boolean; } | - |
opts.compression | boolean | false stores every entry uncompressed |
Returns ​
Promise<string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob>
toBytes() ​
toBytes(
compression?):Uint8Array
Compress all accumulated entries to raw zip bytes.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
compression | boolean | true | false stores every entry uncompressed (level 0) |
Returns ​
Uint8Array