GzipSwift/README.md

1.7 KiB

GzipSwift

macOS iOS watchOS tvOS Swift Carthage compatible Build Status License

GzipSwift is a framework with an extension of Data written in Swift. It enables compress/decompress gzip using zlib.

  • Requirements: OS X 10.9 / iOS 8 / watchOS 2 / tvOS 9 or later
  • Swift version: 3.0 (beta 6)

Usage

import Gzip

// gzip
let compressedData: Data = try! data.gzipped()
let optimizedData: Data = try! data.gzipped(level: .bestCompression)

// gunzip
let decompressedData: Data
if data.isGzipped {
    decompressedData = try! data.gunzipped()
} else {
    decompressedData = data
}

// check data is gzipped
print(compressedData.isGzipped)

Installation

  1. Build Gzip framework.
  2. In Build Phases, add Gzip.framework library to your project.
  3. import Gzip in your Swift file.
  4. Use in your code.

Lisence

© 2014-2016 1024jp

GzipSwift is distributed under the terms of the MIT License. See LISENCE for details.