1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:47:34 +00:00

LibArchive: Add helper functions for adding members to a ZipOutputStream

This commit is contained in:
Caoimhe 2023-06-02 17:31:20 +01:00 committed by Linus Groh
parent 2f85faef0f
commit b5124bd826
3 changed files with 71 additions and 1 deletions

View file

@ -15,6 +15,7 @@
#include <AK/Stream.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/DateTime.h>
#include <string.h>
namespace Archive {
@ -271,9 +272,20 @@ private:
class ZipOutputStream {
public:
struct MemberInformation {
float compression_ratio;
size_t compressed_size;
};
ZipOutputStream(NonnullOwnPtr<Stream>);
ErrorOr<void> add_member(ZipMember const&);
ErrorOr<MemberInformation> add_member_from_stream(StringView, Stream&, Optional<Core::DateTime> const& = {});
// NOTE: This does not add any of the files within the directory,
// it just adds an entry for it.
ErrorOr<void> add_directory(StringView, Optional<Core::DateTime> const& = {});
ErrorOr<void> finish();
private: