Skip to content
forked from 1024jp/GzipSwift

Swift framework that enables gzip/gunzip Data using zlib

License

Notifications You must be signed in to change notification settings

paulgoh/GzipSwift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GzipSwift

Swift ![platform](https://img.shields.io/badge/platform-macOS | iOS | watchOS | tvOS-blue.svg) Carthage compatible Build Status codecov.io 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: Swift 3.0

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.

Build via Carthage

GzipSwift is Carthage compatible. You can easily build GzipSwift adding the following line to your Cartfile.

github "1024jp/GzipSwift" "swift3" ~> 3.0.0

Lisence

© 2014-2016 1024jp

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

About

Swift framework that enables gzip/gunzip Data using zlib

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.9%
  • C 0.1%