32 lines
713 B
C++
32 lines
713 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include "async-io.hh"
|
|
#include "lix/libutil/serialise.hh"
|
|
#include <archive.h>
|
|
|
|
namespace nix {
|
|
|
|
struct TarArchive {
|
|
std::unique_ptr<struct archive, decltype(&archive_read_free)> archive;
|
|
Source * source;
|
|
std::vector<unsigned char> buffer;
|
|
|
|
void check(int err, const std::string & reason = "failed to extract archive (%s)");
|
|
|
|
TarArchive(Source & source, bool raw = false);
|
|
|
|
TarArchive(const Path & path);
|
|
|
|
/// disable copy constructor
|
|
TarArchive(const TarArchive &) = delete;
|
|
|
|
void close();
|
|
};
|
|
|
|
kj::Promise<Result<void>> unpackTarfile(AsyncInputStream & source, const Path & destDir);
|
|
|
|
void unpackTarfile(const Path & tarFile, const Path & destDir);
|
|
|
|
}
|