BuildCache
Functions
bcache::comp Namespace Reference

Compression functions. More...

Functions

std::string compress_lz4 (const std::string &str, int32_t level)
 
std::string compress_zstd (const std::string &str, int32_t level)
 
std::string compress (const std::string &str)
 Compress a string in memory. More...
 
std::string decompress (const std::string &str)
 Decompress a string in memory. More...
 
void compress_file (const std::string &from_path, const std::string &to_path)
 Compress a file. More...
 
void decompress_file (const std::string &from_path, const std::string &to_path)
 Decompress a file. More...
 

Detailed Description

Compression functions.

Function Documentation

◆ compress()

std::string bcache::comp::compress ( const std::string &  str)

Compress a string in memory.

Parameters
strThe string to compress.
Returns
the compressed string.

◆ compress_file()

void bcache::comp::compress_file ( const std::string &  from_path,
const std::string &  to_path 
)

Compress a file.

Parameters
from_pathThe source file (uncompressed).
to_pathThe destination file (compressed).
Exceptions
runtime_errorif the operation could not be completed.

◆ decompress()

std::string bcache::comp::decompress ( const std::string &  str)

Decompress a string in memory.

Parameters
strThe compressed string to decompress.
Returns
the original (decompressed) string.

◆ decompress_file()

void bcache::comp::decompress_file ( const std::string &  from_path,
const std::string &  to_path 
)

Decompress a file.

Parameters
from_pathThe source file (compressed).
to_pathThe destination file (uncompressed).
Exceptions
runtime_errorif the operation could not be completed.