Skip to content

Commit 43165c1

Browse files
committed
Switch implementation over to ZipFoundation
1 parent b506a2f commit 43165c1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Sources/DocUploadBundle/Zipper.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@
1414

1515
import Foundation
1616

17-
import Zip
17+
import ZIPFoundation
1818

1919

2020
enum Zipper {
2121
static func zip(paths inputPaths: [URL], to outputPath: URL) throws {
22-
try Zip.zipFiles(paths: inputPaths, zipFilePath: outputPath, password: nil, progress: nil)
22+
let archive = try Archive(url: outputPath, accessMode: .create)
23+
for url in inputPaths {
24+
try archive.addEntry(with: url.lastPathComponent, fileURL: url)
25+
}
2326
}
2427

2528
static func unzip(from inputPath: URL, to outputPath: URL, fileOutputHandler: ((_ unzippedFile: URL) -> Void)? = nil) throws {
26-
try Zip.unzipFile(inputPath, destination: outputPath, overwrite: true, password: nil, fileOutputHandler: fileOutputHandler)
29+
try FileManager.default.createDirectory(at: outputPath, withIntermediateDirectories: true)
30+
try FileManager.default.unzipItem(at: inputPath, to: outputPath)
2731
}
2832
}
2933

0 commit comments

Comments
 (0)