Commit 3e33d0df authored by patrick piemonte's avatar patrick piemonte

provide a file URL when unzipped

https://github.com/marmelroy/Zip/issues/78
parent f8f690f6
......@@ -82,7 +82,7 @@ public class Zip {
- notes: Supports implicit progress composition
*/
public class func unzipFile(_ zipFilePath: URL, destination: URL, overwrite: Bool, password: String?, progress: ((_ progress: Double) -> ())? = nil) throws {
public class func unzipFile(_ zipFilePath: URL, destination: URL, overwrite: Bool, password: String?, progress: ((_ progress: Double) -> ())? = nil, fileOutputHandler: ((_ unzippedFile: URL) -> Void)? = nil) throws {
// File manager
let fileManager = FileManager.default
......@@ -218,6 +218,11 @@ public class Zip {
progressHandler((currentPosition/totalSize))
}
if let fileHandler = fileOutputHandler,
let fileUrl = URL(string: fullPath) {
fileHandler(fileUrl)
}
progressTracker.completedUnitCount = Int64(currentPosition)
} while (ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment