Closed dfrobese closed 2 years ago
Moin Moin,
Can you give it a try with some smaller sample data and tell me what happens? A simple text file will do:
gzip -9 some_small_file.txt
and tell me if that works? I tested locally with Xcode 11.3.1 and have no problems. Also what is your target platform. MacOS or iOS?
Also, it may sound strange, but can you make sure your file is not zipped twice?
Moin,
Code ` import Foundation
let url: URL! = URL(string: "https://aviationweather.cp.ncep.noaa.gov/adds/dataserver_current/current/metars.cache.xml.gz")!
let compressedData = try? Data(contentsOf: url )
print("Downlaod (url!.path) (compressedData!.count) bytes")
var decompressedData = compressedData!.gunzip() print("File decompressed to (decompressedData!.count) bytes")
let paths = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true) var out: URL? if let path = paths.first { out = URL(fileURLWithPath: path) } out?.appendPathComponent(url.lastPathComponent) out?.deletePathExtension()
try? decompressedData?.write(to: out!)
print("File (out!.path) writes (decompressedData!.count) bytes") `
================================================
Output:
IlPadrino:Debug dfrobese$ ./Download Downlaod /adds/dataserver_current/current/metars.cache.xml.gz 332230 bytes File decompressed to 332157 bytes File /Users/dfrobese/Downloads/metars.cache.xml writes 332157 bytes
================================================= All build on Xcode
Am 15.01.2020
um 12:24 schrieb Markus Wanke notifications@github.com<mailto:notifications@github.com>:
Moin Moin,
Can you give it a try with some smaller sample data and tell me what happens? A simple text file will do:
gzip -9 some_small_file.txt
and tell me if that works? I tested locally with Xcode 11.3.1 and have no problems. Also what is your target platform. MacOS or iOS?
Also, sounds strange, but can you make sure your file is not zipped twice?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mw99/DataCompression/issues/23?email_source=notifications&email_token=AFIP7THLDRQULGG3JJSY2NTQ53W6VA5CNFSM4KG2JMDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI77R3Q#issuecomment-574617838, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFIP7TGWDU6UBXP43R5F6S3Q53W6VANCNFSM4KG2JMDA.
I have problems using gunzip with Swift 5, Xcode 11.3.1
It doesn’t return the inflated content, instead I ‘ve got back the same deflated input data. Executed under test environment or common debug conditions in Xcode. Therefore in the playground environment the same code works perfect as expected!
The file gzipped XML file is about 36kb, inflated expected to be about 4MB
Are there some compiler settings I have to consider? Memory alignment? Any ideas?