-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBugSplatZipHelper.h
More file actions
56 lines (44 loc) · 1.46 KB
/
BugSplatZipHelper.h
File metadata and controls
56 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// BugSplatZipHelper.h
//
// Copyright © BugSplat, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
* Represents a file entry to be added to a ZIP archive.
*/
@interface BugSplatZipEntry : NSObject
@property (nonatomic, copy) NSString *filename;
@property (nonatomic, strong) NSData *data;
+ (instancetype)entryWithFilename:(NSString *)filename data:(NSData *)data;
@end
/**
* Helper class for creating ZIP archives and computing MD5 hashes.
* Uses system zlib library for compression and CommonCrypto for hashing.
*/
@interface BugSplatZipHelper : NSObject
/**
* Creates a ZIP archive containing a single file.
*
* @param data The data to compress and add to the archive.
* @param filename The filename to use inside the ZIP archive.
* @return NSData containing the complete ZIP archive, or nil on failure.
*/
+ (nullable NSData *)zipData:(NSData *)data withFilename:(NSString *)filename;
/**
* Creates a ZIP archive containing multiple files.
*
* @param entries An array of BugSplatZipEntry objects representing files to include.
* @return NSData containing the complete ZIP archive, or nil on failure.
*/
+ (nullable NSData *)zipEntries:(NSArray<BugSplatZipEntry *> *)entries;
/**
* Calculates the MD5 hash of the given data.
*
* @param data The data to hash.
* @return A lowercase hexadecimal string representation of the MD5 hash.
*/
+ (NSString *)md5HashOfData:(NSData *)data;
@end
NS_ASSUME_NONNULL_END