Flowdock
method

deflate

Importance_2
Ruby latest stable (v1_9_3_392) - 0 notes - Class: Zlib
deflate(p1, p2 = v2) public

Arguments

string

String

flush

Integer representing a flush code. Either NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, or FINISH. See zlib.h for details. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression.

Description

Inputs string into the deflate stream and returns the output from the stream. On calling this method, both the input and the output buffers of the stream are flushed.

If string is nil, this method finishes the stream, just like Zlib::ZStream#finish.

Usage

comp = Zlib.deflate(File.read("big.file"))

or

comp = Zlib.deflate(File.read("big.file"), Zlib::FULL_FLUSH)
Show source
Register or log in to add new notes.