Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::archiver Namespace Reference

Archiver is used to generate/read encrypted archives. More...

Typedefs

using FileMatchPair = std::function< std::pair< bool, std::string_view >(std::string_view)>
 

Functions

std::vector< uint8_tcompress (const std::string &str)
 Compress a STL string using zlib with given compression level and return the binary data.
 
void compressGzip (const std::string &str, const std::string &path)
 Compress string to a Gzip file.
 
void compressGzip (const std::vector< uint8_t > &dat, const std::string &path)
 
std::vector< uint8_tdecompress (const std::vector< uint8_t > &dat)
 Decompress an STL string using zlib and return the original data.
 
std::vector< uint8_tdecompressGzip (const std::string &path)
 Decompress Gzip file to bytes.
 
std::vector< std::string > listFilesFromArchive (const std::string &path)
 listFilesFromArchive list all files from an archive
 
gzFile openGzip (const std::string &path, const char *mode)
 Open Gzip file (uses wide string version of gzopen on windows)
 
std::vector< uint8_treadFileFromArchive (const std::string &path, const std::string &fileRelativePathName)
 readFileFromArchive read a file from an archive without uncompressing the whole archive
 
void uncompressArchive (const std::string &path, const std::string &dir, const FileMatchPair &f)
 uncompressArchive Uncompresses an archive and puts the different files in dir folder according to a FileMatchPair f
 

Detailed Description

Archiver is used to generate/read encrypted archives.

Typedef Documentation

◆ FileMatchPair

using jami::archiver::FileMatchPair = typedef std::function<std::pair<bool, std::string_view>(std::string_view)>

Definition at line 40 of file archiver.h.

Function Documentation

◆ compress()

std::vector< uint8_t > jami::archiver::compress ( const std::string &  str)

Compress a STL string using zlib with given compression level and return the binary data.

Definition at line 56 of file archiver.cpp.

References compress(), and jami::emitSignal().

Referenced by compress(), and jami::fileutils::writeArchive().

Here is the call graph for this function:

◆ compressGzip() [1/2]

void jami::archiver::compressGzip ( const std::string &  str,
const std::string &  path 
)

Compress string to a Gzip file.

Definition at line 76 of file archiver.cpp.

References jami::emitSignal(), and openGzip().

Referenced by jami::fileutils::writeArchive().

Here is the call graph for this function:

◆ compressGzip() [2/2]

void jami::archiver::compressGzip ( const std::vector< uint8_t > &  dat,
const std::string &  path 
)

Definition at line 84 of file archiver.cpp.

References jami::emitSignal(), and openGzip().

Here is the call graph for this function:

◆ decompress()

std::vector< uint8_t > jami::archiver::decompress ( const std::vector< uint8_t > &  str)

Decompress an STL string using zlib and return the original data.

Definition at line 111 of file archiver.cpp.

References jami::emitSignal().

Referenced by jami::fileutils::readArchive().

Here is the call graph for this function:

◆ decompressGzip()

std::vector< uint8_t > jami::archiver::decompressGzip ( const std::string &  path)

Decompress Gzip file to bytes.

Definition at line 92 of file archiver.cpp.

References jami::emitSignal(), and openGzip().

Here is the call graph for this function:

◆ listFilesFromArchive()

std::vector< std::string > jami::archiver::listFilesFromArchive ( const std::string &  path)

listFilesFromArchive list all files from an archive

Parameters
patharchive path
Returns
std::vector<std::string> that contains all files relative path names

Definition at line 438 of file archiver.cpp.

References jami::emitSignal().

Referenced by jami::JamiPluginManager::checkPluginSignatureFile().

Here is the call graph for this function:

◆ openGzip()

gzFile jami::archiver::openGzip ( const std::string &  path,
const char mode 
)

Open Gzip file (uses wide string version of gzopen on windows)

Definition at line 154 of file archiver.cpp.

References jami::emitSignal().

Referenced by compressGzip(), compressGzip(), and decompressGzip().

Here is the call graph for this function:

◆ readFileFromArchive()

std::vector< uint8_t > jami::archiver::readFileFromArchive ( const std::string &  path,
const std::string &  fileRelativePathName 
)

readFileFromArchive read a file from an archive without uncompressing the whole archive

Parameters
patharchive path
fileRelativePathNamefile path relative path name in the archive E.g: data/myfile.txt inside the archive
Returns
fileContent std::vector<uint8_t> that contains the file content

Definition at line 348 of file archiver.cpp.

References jami::emitSignal().

Referenced by jami::JamiPluginManager::checkPluginSignatureValidity(), jami::PluginUtils::readPluginCertificateFromArchive(), jami::PluginUtils::readPluginManifestFromArchive(), jami::PluginUtils::readPluginSignatureFromArchive(), and jami::PluginUtils::readSignatureFileFromArchive().

Here is the call graph for this function:

◆ uncompressArchive()

void jami::archiver::uncompressArchive ( const std::string &  path,
const std::string &  dir,
const FileMatchPair f 
)

uncompressArchive Uncompresses an archive and puts the different files in dir folder according to a FileMatchPair f

Parameters
path
dir
ftakes a filename relative path inside the archive like mysubfolder/myfile and returns a pair (bool, new filename relative path) Where the bool indicates if we should uncompress this file and the new filename relative path puts the file in the directory dir under a different relative path name like mynewsubfolder/myfile
Returns
void

Definition at line 212 of file archiver.cpp.

References DIR_SEPARATOR_CH, DIR_SEPARATOR_STR, and jami::emitSignal().

Referenced by jami::JamiPluginManager::installPlugin().

Here is the call graph for this function: