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>
14
15#include <memory>
16#include <string>
17#include <vector>
18
19namespace OpenMS
20{
21
30 class OPENMS_DLLAPI ZipArchiveFile
31 {
32 public:
44 static void zipDirectory(const String& directory_path, const String& output_zip);
45
61 static String unzipDirectory(const String& input_path, std::unique_ptr<File::TempDir>& temp_dir);
62
78 static void addOrReplaceFromFile(const String& archive_path, const String& entry_name, const String& source_file_path);
79
87 static std::vector<String> listEntries(const String& archive_path);
88
105 static void writeSidecarIndex(const String& archive_path);
106
122 static String extractEntryToTempFile(const String& archive_path, const String& entry_name, std::unique_ptr<File::TempDir>& temp_dir);
123
124 };
125
126} // namespace OpenMS
A more convenient string class.
Definition String.h:34
Small libzip-based helpers for working with ZIP archives.
Definition ZipArchiveFile.h:31
static void zipDirectory(const String &directory_path, const String &output_zip)
Create a store-only zip archive from a directory (no additional compression)
static std::vector< String > listEntries(const String &archive_path)
List entries in a zip archive (returns empty list if not available)
static String unzipDirectory(const String &input_path, std::unique_ptr< File::TempDir > &temp_dir)
Unpack a zip archive into a temporary directory and return the usable path.
static void writeSidecarIndex(const String &archive_path)
Write a small JSON sidecar index for the archive listing entries and sizes.
static String extractEntryToTempFile(const String &archive_path, const String &entry_name, std::unique_ptr< File::TempDir > &temp_dir)
Extract a single entry from a zip archive into a temporary file and return its path.
static void addOrReplaceFromFile(const String &archive_path, const String &entry_name, const 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