S4 and C7 support for gzip
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources/gzip-openswift
Tests
.gitignore
.swift-version
.travis.yml
LICENSE
Package.swift
README.md

README.md

gzip

Build Status Platforms Package Managers

Blog Twitter Czechboy0

gzip support for S4 and C7

Usage

Adds support for C7.Data.

let myData = ... //C7.Data
let myGzipCompressedData = try myData.gzipCompressed() //C7.Data
...
let myGzipUncompressedData = try myGzipCompressedData.gzipUncompressed() //C7.Data
... //PROFIT!

Also contains a GzipStream class which conforms to C7.ReceivingStream, so it can be easily attached in a pipeline, like

let gzippedStream = ... //e.g. from S4.Body
let uncompressedStream = try GzipStream(rawStream: gzippedStream, mode: .uncompress)
... //PROFIT!

Also contains a S4 compatible Middleware, which automatically adds the right headers to the request and decompresses the response if it's compressed.

let client = HTTPSClient.Client("https://my.server")
let response = client.get("/compressed", middleware: GzipMiddleware())
response.body.becomeBuffer() //<- Already decompressed data

Installation

Swift Package Manager

.Package(url: "https://github.com/czechboy0/gzip-openswift.git", majorVersion: 0, minor: 1)

💝 Contributing

Please create an issue with a description of your problem or open a pull request with a fix.

✌️ License

MIT

👽 Author

Honza Dvorsky - http://honzadvorsky.com, @czechboy0