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
36
votes
4 answers

How to check if a file is gzip compressed?

I have a C / C++ program which needs to read in a file that may or may not be gzip compressed. I know we can use gzread() from zlib to read in both compressed and uncompressed files - however, I want to use the zlib functions ONLY if the file is…
Deepak Prakash
  • 840
  • 1
  • 8
  • 13
35
votes
1 answer

Error Deflate And Inflate With zLib

I'm trying to compile the zpipe.c example in my Linux(Ubuntu 8.04) with gcc, but I'm getting some errors, take a look: [ubuntu@eeepc:~/Desktop] gcc zpipe.c /tmp/ccczEQxz.o: In function `def': zpipe.c:(.text+0x65): undefined reference to…
Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
35
votes
3 answers

How to pipe one readable stream into two writable streams at once in Node.js?

The goal is to: Create a file read stream. Pipe it to gzip (zlib.createGzip()) Then pipe the read stream of zlib output to: 1) HTTP response object 2) and writable file stream to save the gzipped output. Now I can do down to 3.1: var gzip =…
esengineer
  • 9,514
  • 7
  • 45
  • 69
34
votes
8 answers

Unresolved externals despite linking in zlib.lib

I've been trying to compile an application which utilizes zlib compression in VC++ 2010. I get the error: error LNK2019: unresolved external symbol inflateInit2 referenced in function ... Which wouldn't be unusual if I didn't link the lib. I link…
RSuthke
  • 433
  • 1
  • 5
  • 9
33
votes
6 answers

Python: Creating a streaming gzip'd file-like?

I'm trying to figure out the best way to compress a stream with Python's zlib. I've got a file-like input stream (input, below) and an output function which accepts a file-like (output_function, below): with open("file") as input: …
David Wolever
  • 148,955
  • 89
  • 346
  • 502
33
votes
3 answers

Node.js - Zip/Unzip a folder

I'm diving into Zlib of node.js. I was able to compress and uncompress files using the provided examples (http://nodejs.org/api/zlib.html#zlib_examples) but I didn't be able to find more about doing the same for folders? One possibility (but that I…
Hassen
  • 6,966
  • 13
  • 45
  • 65
32
votes
13 answers

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in

I don't have any problem on localhost. but when i tested my codes on server, end of every page i see this notice. my code:
AliN11
  • 2,387
  • 1
  • 25
  • 40
31
votes
6 answers

How to point cmake to zlib include path?

Or any include directory/library. I use cmake gui tool so I run it and usually the gui will highlight the include or library it can't find and let you open a open dialog to set the path however it doesn't do that for this cmake cofig it tell you in…
graham
  • 411
  • 1
  • 4
  • 5
29
votes
1 answer

zlib: Differences Between the `deflate` and `compress` Functions

What are the differences between the deflate() and compress() functions in zlib? I have looked through online examples and some used deflate while others used compress. How should I decide which situation I would use one over the other?
mma1480
  • 659
  • 1
  • 9
  • 18
28
votes
2 answers

error when import zlib in iOS: symbol(s) not found collect2: ld

I have included in my iphone application and the source code I was mocking up the sample code of Molecules provided by Brad Larson, however, when I build the project, it returns the error as below. Can anyone point out for me whether this…
issac
  • 1,501
  • 6
  • 22
  • 29
28
votes
1 answer

How to find a good/optimal dictionary for zlib 'setDictionary' when processing a given set of data?

I have a (huge) set of similar data files. The set is constantly growing. The size of a single file is about 10K. Each file must be compressed on its own. The compression is done with the zlib library, which is used by the java.util.zip.Deflater…
Miro
  • 281
  • 1
  • 3
  • 4
26
votes
8 answers

What's the proper way to handle back-pressure in a node.js Transform stream?

##Intro These are my first adventures in writing the node.js server side. It's been fun so far but I'm having some difficulty understanding the proper way to implement something as it relates to node.js streams. ###Problem For test and learning…
Scott Saad
  • 17,962
  • 11
  • 63
  • 84
25
votes
2 answers

Linking with libpng & zlib?

I'm trying to compile a project that uses both libjpeg and libpng. I know that libpng needs zlib, so I compiled all the three independently and put them (libjpeg.a, libpng.a and libz.a) on a folder called linrel32. What I execute then is: g++…
huff
  • 1,954
  • 2
  • 28
  • 49
24
votes
4 answers

Compressing multiple files using zlib

The below code will compress one file. How can I compress multiple files var gzip = zlib.createGzip(); var fs = require('fs'); var inp = fs.createReadStream('input.txt'); var out = fs.createWriteStream('input.txt.gz'); inp.pipe(gzip).pipe(out);
user3180402
  • 579
  • 2
  • 7
  • 16
24
votes
2 answers

What exactly is DEFAULT_COMPRESSION?

Of the possible DEFLATE compression levels [0 .. 9], which one exactly Java's Deflater.DEFAULT_COMPRESSION correspond to? In the Java source code, I see it as public static final int DEFAULT_COMPRESSION = -1;
kolistivra
  • 4,229
  • 9
  • 45
  • 58