Zip Container Structure. Based on libzip.
More...
#include <zip_container.h>
Zip Container Structure. Based on libzip.
◆ ZipContainer() [1/3]
ZipContainer::ZipContainer |
( |
std::string && |
data | ) |
|
Constructor. Takes a string argument. This is mainly used for Pistache data receiving.
- Parameters
-
data | Zip File Data. Note: Will use entire data.capacity() as ZIP file array, not just data.size() |
- Exceptions
-
Throws | std::logic_error on failure |
◆ ZipContainer() [2/3]
ZipContainer::ZipContainer |
( |
std::vector< uint8_t > && |
data | ) |
|
Constructor. Initializes zip_t.
- Parameters
-
- Exceptions
-
Throws | std::logic_error on failure |
◆ ZipContainer() [3/3]
ZipContainer::ZipContainer |
( |
const std::string & |
path, |
|
|
bool |
readOnly, |
|
|
bool |
saveOnDestruct |
|
) |
| |
Constructor. Loads data from file at path.
- Parameters
-
path | Path to Zip Archive |
readOnly | Should archive be opened in read-only mode |
saveOnDestruct | Should the archive be saved automatically on destruct |
◆ ~ZipContainer()
ZipContainer::~ZipContainer |
( |
| ) |
|
|
noexcept |
Destructor. Will save zip archive if requested.
◆ compressPath()
ZipContainer ZipContainer::compressPath |
( |
const std::filesystem::path & |
path, |
|
|
bool |
keepRelDirStruct = false |
|
) |
| |
|
static |
Compress files and directories under path.
- Parameters
-
path | Path to directory that should be compressed |
keepRelDirStruct | Should the created zip archive keep the relative directory structure to path. If false, will save files inside path directly |
- Returns
- Returns ZipContainer with compressed contents
- Exceptions
-
Throws | std::logic_error on fail |
◆ extractZipFiles()
void ZipContainer::extractZipFiles |
( |
std::string |
path | ) |
const |
Extract Zip Files and store them under path.
- Parameters
-
path | Path to extraction directory |
- Exceptions
-
Throws | std::logic_error on fail |
◆ getCompressedData()
std::vector< uint8_t > ZipContainer::getCompressedData |
( |
| ) |
const |
Get zip archive's compressed data.
- Returns
- Returns compressed data
◆ saveToDestination()
void ZipContainer::saveToDestination |
( |
const std::string & |
dest | ) |
const |
Save Archive to storage.
- Parameters
-
- Exceptions
-
Throws | std::logic_error on fail |
The documentation for this class was generated from the following files: