ZipArchive
12 Sep 20252 minutes to read
class provide compression library
let archive = new ZipArchive();
archive.compressionLevel = 'Normal';
let archiveItem = new ZipArchiveItem(archive, 'directoryName\fileName.txt');
archive.addItem(archiveItem);
archive.save(fileName.zip);Properties
compressionLevel CompressionLevel
gets compression level
length number
gets items count
Methods
addDirectory
add new directory to archive
| Parameter | Type | Description | 
|---|---|---|
| directoryName | string | 
      directoryName to be created | 
Returns void
addItem
add new item to archive
| Parameter | Type | Description | 
|---|---|---|
| item | ZipArchiveItem | 
      item to be added | 
Returns void
contains
determines whether an element is in the collection
| Parameter | Type | Description | 
|---|---|---|
| item | 
string |  ZipArchiveItem
 | 
      item to search | 
Returns boolean
destroy
release allocated un-managed resource
Returns void
getItem
gets item at specified index
| Parameter | Type | Description | 
|---|---|---|
| index | number | 
      item index | 
Returns ZipArchiveItem
save
save archive with specified file name
| Parameter | Type | Description | 
|---|---|---|
| fileName | string | 
      save archive with specified file name | 
Returns Promise
saveAsBlob
Save archive as blob
Returns Promise