Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A simple NSData category for gzipping/unzipping data in iOS and Mac OS
branch: master

This branch is 5 commits behind nicklockwood:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
GZIP
Tests
LICENCE.md
README.md
RELEASE NOTES.md

README.md

Purpose

GZIP is category on NSData that provides simple gzip compression and decompression functionality.

Supported OS & SDK Versions

  • Supported build target - iOS 5.1 / Mac OS 10.7 (Xcode 4.3, Apple LLVM compiler 3.0)
  • Earliest supported deployment target - iOS 4.3 / Mac OS 10.6
  • Earliest compatible deployment target - iOS 3.0 / Mac OS 10.6

NOTE: 'Supported' means that the library has been tested with this version. 'Compatible' means that the library should work on this iOS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

ARC Compatibility

The GZIP category will work correctly in either ARC or non-ARC projects without modification.

Thread Safety

All the GZIP methods should be safe to call from multiple threads concurrently.

Installation

To use the GZIP category in an app, just drag the category files (test files and assets are not needed) into your project and import the header file into any class where you wish to make use of the GZIP functionality. You will also need to include the libz.dylib.

NSData Extensions

- (NSData *)gzippedDataWithCompressionLevel:(float)level;

This method will apply the gzip deflate algorithm and return the compressed data. The compression level is a floating point value between 0.0 and 1.0, with 0.0 meaning no compression and 1.0 meaning maximum compression. A value of 0.1 will provide the fastest possible compression. If you supply a negative value, this will apply the default compression level, which is equivalent to a value of around 0.7.

- (NSData *)gzippedData;

This method is equivalent to calling gzippedDataWithCompressionLevel: with the default compression level.

- (NSData *)gunzippedData;

This method will unzip data that was compressed using the deflate algorithm and return the result.

Something went wrong with that request. Please try again.