Questions tagged [zlib]

zlib is a library used for data compression. Also a crucial component of many software platforms including Linux, Mac OS X, and the iOS

zlib is a library (current version: 1.2.8, released April 28, 2013) that is very widely used for doing data compression. It is open source software written in C, and is unencumbered by patents. It supports three principal compression formats:

  • format Raw compressed data
  • format data (essentially just raw data with a small header)
  • format data (the raw data with a considerably more sophisticated header)

Documentation may be found in RFC-1950 (zlib), RFC-1951 (deflate), and RFC-1952 (gzip).

The zlib library was created by Jean-loup Gailly and Mark Adler.

2362 questions
23
votes
1 answer

Unzip buffer with Python?

I have a buffer of bytes read from a library call and I would like to unzip the content which is a single text file. I tried with zlib, but I get this error: >>> import zlib >>> zlib.decompress(buffer) error: Error -3 while decompressing data:…
nowox
  • 25,978
  • 39
  • 143
  • 293
21
votes
3 answers

How can I install zlib on Mac OS X Mojave (10.14)?

I recently upgraded from Sierra to Mojave. After that I tried to use pyenv install 3.5.6. This uses homebrew in the background to try to install python, which fails with zipimport.ZipImportError: can't decompress data; zlib not available. The same…
geoidesic
  • 4,649
  • 3
  • 39
  • 59
21
votes
9 answers

ZLIB Decompression - Client Side

I am receiving data as an "ZLIB" compressed inputstream. Using Javascript/Ajax/JQuery, I need to uncompress it on the client side. Is there a way to do so? I already have this working in JAVA as below, but need to do this on Client Side. url = new…
Rajeev Raina
  • 239
  • 1
  • 3
  • 8
20
votes
1 answer

Difference between mod_deflate and zlib output_compression

Can anyone tell me the difference between using mod_deflate and zlib output_compression? I understand that zlib is done in PHP and mod_deflate is done in Apace, my .htaccess file looks like: php_flag zlib.output_compression On or: SetOutputFilter…
fire
  • 21,383
  • 17
  • 79
  • 114
19
votes
3 answers

CMake zlib build on Windows

I'm trying to build zlib 1.2.8 for Windows using CMake, but I get build errors that I don't know how to fix. Here's my CMake GUI: This generates without errors, but when I build the resulting solution. I get this error: 2>------ Build started:…
elveatles
  • 2,160
  • 3
  • 18
  • 16
18
votes
2 answers

Python equivalent of unix cksum function

I've been looking for the equivalent python method for the unix cksum command: http://pubs.opengroup.org/onlinepubs/7990989775/xcu/cksum.html $ cksum ./temp.bin 1605138151 712368 ./temp.bin So far I have found the zlib.crc32() function >>> import…
Dan
  • 1,029
  • 9
  • 14
17
votes
5 answers

Save file from a byte[] in C# NET 3.5

My TCP Client receives a image within a packet.The image is compressed with zlib.The task is to decompress the image and put it on the form. I'm planning to save the compressed image in the current directory,decompress it and load the decompressed…
Ivan Prodanov
  • 34,634
  • 78
  • 176
  • 248
17
votes
2 answers

Installing latest 1.44 boost library under ubuntu 10.04

I have ubuntu 10.04 and want to install the latest boost library 1.44_0 I downloaded the tar.gz file and unpacked it into /usr/local/boost_1_44_0 I already have the boost 1.40 version install from synaptic. So I want to compile and link against 1.44…
hookenz
  • 36,432
  • 45
  • 177
  • 286
17
votes
3 answers

Cross Compile OpenSSH for ARM

Does anybody know how I can cross compile OpenSSH for ARM? This is what I have done: First I've downloaded Zlib source code, untarred it, built it and installed it using the following command lines: # ./configure --prefix=/usr/local/cross/arm …
arian
  • 181
  • 1
  • 1
  • 4
16
votes
5 answers

How do I read / write gzipped files in C++?

How do I read / write gzipped files in C++? The iostream wrapper classes here look good, and here is a simple usage example: gz::igzstream in(filename); std::string line; while(std::getline(in, line)){ std::cout << line << std::endl; } But I…
Frank
  • 64,140
  • 93
  • 237
  • 324
16
votes
8 answers

Compiling boost with zlib

I'm compiling boost with bjam under Windows 7 (64bit-should be irrelevant) D:\development\boost\boost_1_44\libs\iostreams\build>bjam stage ^ --toolset=msvc-10.0 link=static ^ --build-type=complete ^ -s ZLIB_SOURCE=C:\zlib125-dll ^ -s…
cppanda
  • 1,235
  • 1
  • 15
  • 29
16
votes
3 answers

Read gzip stream line by line

I've got a compressed gzip file which I would like to read line by line. var fs = require('fs') var zlib = require('zlib') var gunzip = zlib.createGunzip() var inp = fs.createReadStream('test.gz') var n = 0 var lineProcessing = function (err, data)…
Markus
  • 2,998
  • 1
  • 21
  • 28
16
votes
3 answers

Python zipfile, How to set the compression level?

Python supports zipping files when zlib is available, ZIP_DEFLATE see: https://docs.python.org/3.4/library/zipfile.html The zip command-line program on Linux supports -1 fastest, -9 best. Is there a way to set the compression level of a zip file…
ideasman42
  • 42,413
  • 44
  • 197
  • 320
16
votes
3 answers

How do I use Minizip (on Zlib)?

I'm trying to archive files for a cross-platform application, and it looks like Minizip (built on zlib) is about as portable as archivers come. When I try to run the following dummy code, however, I get a system error [my executable] has stopped…
JellicleCat
  • 28,480
  • 24
  • 109
  • 162
15
votes
2 answers

zlib compressing byte array?

I have this uncompressed byte array: 0E 7C BD 03 6E 65 67 6C 65 63 74 00 00 00 00 00 00 00 00 00 42 52 00 00 01 02 01 00 BB 14 8D 37 0A 00 00 01 00 00 00 00 05 E9 05 E9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 81 01 00 00 00 00 00…
Guapo
  • 3,446
  • 9
  • 36
  • 63