We’ve got an utility that compress a SQlite file in Home windows utilizing C# System.IO.Compression.GZipStream. After compression of SQLite file, we’re pushing the compressed file(.gzip) to a server the place iOS will obtain it.
Our downside is that after downloading the iOS cannot uncompressed the file, it’s getting UNZ_BADZIPFILE (-103) error. Our ios app is utilizing SSZipArchive library to unzip the .gzip file. We tried to manually obtain the file in Mac machine and we’re in a position to unzip the file. I do not know what’s the subject. Is it as a result of the gzip file was created in home windows machine?
Right here is our code to compress the file in C# and produce a .gzip file.
FileInfo fileToBeGZipped = new FileInfo(filePath);
FileInfo gzipFileName = new FileInfo(string.Concat(fileToBeGZipped.FullName, ".gzip"));
utilizing (FileStream fileToBeZippedAsStream = fileToBeGZipped.OpenRead())
{
utilizing (FileStream gzipTargetAsStream = gzipFileName.Create())
{
utilizing (GZipStream gzipStream = new GZipStream(gzipTargetAsStream, CompressionMode.Compress))
{
attempt
{
fileToBeZippedAsStream.CopyTo(gzipStream);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}