1
0
mirror of synced 2024-12-14 00:32:52 +01:00
ImHex/lib/libimhex/include/hex/helpers/tar.hpp

35 lines
696 B
C++

#pragma once
#include <hex.hpp>
#include <hex/helpers/fs.hpp>
#include <microtar.h>
namespace hex {
class Tar {
public:
enum class Mode {
Read,
Write,
Create
};
Tar() = default;
Tar(const std::fs::path &path, Mode mode);
~Tar();
std::vector<u8> read(const std::fs::path &path);
void write(const std::fs::path &path, const std::vector<u8> &data);
std::vector<std::fs::path> listEntries();
void extract(const std::fs::path &path, const std::fs::path &outputPath);
void extractAll(const std::fs::path &outputPath);
private:
mtar_t m_ctx = { };
};
}