Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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

About

S4 and C7 support for gzip

Resources

License

Packages

No packages published

Languages