ZipFile Class - raravel/libzip GitHub Wiki
This class like C# ZipFile
Provides static methods for creating, extracting, and opening zip archives.
Methods
CreateFromDirectory
Creates a zip archive that contains the files and directories from the specified directory.
Source: libzip.ts:408
Arguments
| Type | Name | Description | Necessary |
|---|---|---|---|
| String | src | Source directory | TRUE |
| String | dst | Destination zip file name | TRUE |
| String | passwd | Zip file password | FLASE |
Example
import { ZipFile } from 'libzip';
ZipFile.CreateFromDirectory('src path', 'dst path.zip');
ExtractToDirectory
Extracts all the files in the specified zip archive to a directory on the file system.
Source: libzip.ts:429
Arguments
| Type | Name | Description | Necessary |
|---|---|---|---|
| String | src | Extract target zip file | TRUE |
| String | dst | Destination directory name | TRUE |
| String | passwd | Zip file password | FLASE |
Example
import { ZipFile } from 'libzip';
ZipFile.ExtractToDirectory('src path.zip', 'dst path');
Open
Opens a zip archive at the specified path.
Source: libzip.ts:452
Arguments
| Type | Name | Description | Necessary |
|---|---|---|---|
| String | src | Open target zip file | TRUE |
Example
import { ZipFile, ZipArchive } from 'libzip';
const archive: ZipArchive = ZipFile.Open('zip file path.zip');
/* do something */