Skip to content

Commit 7079392

Browse files
Merge pull request #23 from SwiftPackageIndex/switch-zip-library
Switch zip library
2 parents 590ca3f + 43165c1 commit 7079392

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ let package = Package(
4040
.package(url: "https://github.com/swift-server/swift-aws-lambda-events.git", from: "0.1.0"),
4141
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", from: "1.0.0-alpha.1"),
4242
.package(url: "https://github.com/soto-project/soto-s3-file-transfer.git", from: "1.2.0"),
43-
.package(url: "https://github.com/marmelroy/Zip.git", from: "2.1.2"),
43+
.package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.19"),
4444
.package(url: "https://github.com/pointfreeco/swift-dependencies.git", from: "1.0.0")
4545
],
4646
targets: [
@@ -56,7 +56,7 @@ let package = Package(
5656
linkerSettings: linkerSettings
5757
),
5858
.target(name: "DocUploadBundle", dependencies: [
59-
.product(name: "Zip", package: "Zip"),
59+
.product(name: "ZIPFoundation", package: "zipfoundation"),
6060
.product(name: "Dependencies", package: "swift-dependencies")
6161
]),
6262
.testTarget(name: "DocUploadBundleTests", dependencies: ["DocUploadBundle"], exclude: ["Fixtures"]),

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)