Poco::Zip

class ZipManipulator

File Information

Library: Zip
Package: Manipulation
Header: Poco/Zip/ZipManipulator.h

Description

ZipManipulator allows to add/remove/update files inside zip files

Member Summary

Member Functions: addFile, commit, deleteFile, originalArchive, renameFile, replaceFile

Constructors

ZipManipulator

ZipManipulator(
    const std::string & zipFile,
    bool backupOriginalFile
);

Creates the ZipManipulator.

Destructor

~ZipManipulator virtual

virtual ~ZipManipulator();

Destroys the ZipManipulator.

Member Functions

addFile

void addFile(
    const std::string & zipPath,
    const std::string & localPath,
    ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE,
    ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM
);

Adds a file to the zip file.

commit

ZipArchive commit();

Commits all changes and re-creates the Zip File with the changes applied. Returns the ZipArchive for the newly created archive

Changes will be first written to a temporary file, then the originalfile will be either deleted or renamed to .bak, then, the temp file will be renamed to the original zip file name.

deleteFile

void deleteFile(
    const std::string & zipPath
);

Removes the given file from the Zip archive.

originalArchive inline

const ZipArchive & originalArchive() const;

Returns the original archive information

renameFile

void renameFile(
    const std::string & zipPath,
    const std::string & newZipPath
);

Renames the file in the archive to newZipPath

replaceFile

void replaceFile(
    const std::string & zipPath,
    const std::string & localPath
);

Replaces the contents of the file in the archive with the contents from the file given by localPath.

Variables

EDone

Poco::FIFOEvent < const ZipLocalFileHeader > EDone;

Securely control IoT edge devices from anywhere   Connect a Device