【问题标题】:.XZ file with swift on apple tv.XZ 文件与苹果电视上的 swift
【发布时间】:2018-06-12 05:03:22
【问题描述】:

我喜欢在我的 xcode 项目中解压缩 .xz 文件格式。这已经实现了吗?

直到现在我都使用 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
            }                                       
        }
}

【问题讨论】:

  • tukaani.org/xz写一个快速包装器,你应该可以解压.xz文件

标签: swift zip compression apple-tv xz


【解决方案1】:

我成功使用了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)
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    • 2017-05-29
    • 2023-04-04
    相关资源
    最近更新 更多