OpenMS
Loading...
Searching...
No Matches
ZipArchiveFile.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Justin Sing $
6// $Authors: Justin Sing $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/config.h>
13#include <OpenMS/SYSTEM/File.h>
15
16#include <memory>
17#include <string>
18#include <vector>
19
20namespace OpenMS
21{
22
31 class OPENMS_DLLAPI ZipArchiveFile
32 {
33 public:
45 static void zipDirectory(const std::string& directory_path, const std::string& output_zip);
46
62 static std::string unzipDirectory(const std::string& input_path, std::unique_ptr<TempDir>& temp_dir);
63
79 static void addOrReplaceFromFile(const std::string& archive_path, const std::string& entry_name, const std::string& source_file_path);
80
88 static std::vector<std::string> listEntries(const std::string& archive_path);
89
106 static void writeSidecarIndex(const std::string& archive_path);
107
123 static std::string extractEntryToTempFile(const std::string& archive_path, const std::string& entry_name, std::unique_ptr<TempDir>& temp_dir);
124
125 };
126
127} // namespace OpenMS
Small libzip-based helpers for working with ZIP archives.
Definition ZipArchiveFile.h:32
static std::vector< std::string > listEntries(const std::string &archive_path)
List entries in a zip archive (returns empty list if not available)
static std::string extractEntryToTempFile(const std::string &archive_path, const std::string &entry_name, std::unique_ptr< TempDir > &temp_dir)
Extract a single entry from a zip archive into a temporary file and return its path.
static void zipDirectory(const std::string &directory_path, const std::string &output_zip)
Create a store-only zip archive from a directory (no additional compression)
static void writeSidecarIndex(const std::string &archive_path)
Write a small JSON sidecar index for the archive listing entries and sizes.
static std::string unzipDirectory(const std::string &input_path, std::unique_ptr< TempDir > &temp_dir)
Unpack a zip archive into a temporary directory and return the usable path.
static void addOrReplaceFromFile(const std::string &archive_path, const std::string &entry_name, const std::string &source_file_path)
Add or replace an entry inside an existing zip archive from a file on disk.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19