0

i like to decompress an .xz file format in my xcode project. Has this already implemented one?

i used so until now GzipSwift

Alamofire.request("http:.../file.xz", parameters: nil) //Alamofire defaults to GET requests
    .response { response in
        if let data = response.data {
            let decompressedData: Data
            if data.isGzipped {
                decompressedData = try! data.gunzipped()
            } else {
                decompressedData = data
            }                                       
        }
}
4

1 回答 1

0

我成功使用了SWCompression框架

import SWCompression

...

do {
   decompressedData = try XZArchive.unarchive(archive: data)
} catch let _error as XZError {
   print("decompressed Data XZ error " + _error.localizedDescription)
} catch let _error {
   print("Data error " + _error.localizedDescription)
}
于 2018-01-02T14:36:46.820 回答