2014-12-08 05:09:33 +08:00
|
|
|
|
|
|
|
NSData+GZIP.swift
|
|
|
|
========================
|
|
|
|
|
2015-07-18 10:49:28 +08:00
|
|
|
[![Build Status](http://img.shields.io/travis/1024jp/NSData-GZIP/master.svg?style=flat)](https://travis-ci.org/1024jp/NSData-GZIP)
|
2015-05-12 11:13:49 +08:00
|
|
|
|
2015-07-19 11:57:38 +08:00
|
|
|
__NSData+GZIP.swift__ is an extension of NSData written in Swift 2.0. It enables compress/decompress gzip using zlib.
|
2014-12-08 05:09:33 +08:00
|
|
|
|
|
|
|
- __Requirements__: OS X 10.9 / iOS 7 or later
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```swift
|
|
|
|
// gzip
|
2015-08-27 03:04:32 +08:00
|
|
|
let compressedData : NSData = try! data.gzippedData()
|
2014-12-08 05:09:33 +08:00
|
|
|
|
|
|
|
// gunzip
|
2015-08-27 03:04:32 +08:00
|
|
|
let decompressedData : NSData = try! compressedData.gunzippedData()
|
2014-12-08 05:09:33 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
1. Add `NSData+GZIP.swift` file to your project.
|
2015-08-27 01:13:59 +08:00
|
|
|
2. Add `libz.tbd` library to your project.
|
2014-12-08 05:09:33 +08:00
|
|
|
3. Add a line `#include <zlib.h>` to your ProjectName-Bridging-Header.h file.
|
|
|
|
4. Invoke from your Swift/ObjC files.
|
|
|
|
|
|
|
|
|
|
|
|
## Lisence
|
|
|
|
|
2015-05-12 09:05:34 +08:00
|
|
|
© 2014-2015 1024jp
|
2014-12-08 05:09:33 +08:00
|
|
|
|
|
|
|
NSData+GZIP.swift is distributed under the terms of the __MIT License__. See [LISENCE](LISENCE) for details.
|