Comments (7)
I was planning on building a small framework for compression based on zlib. Basically pass in an NSData and get a compressed NSData and vice versa.
from kitura.
Just providing this link as reference to the team: https://en.wikipedia.org/wiki/HTTP_compression
from kitura.
I agree we should probably use the "de facto" standard of zlib for this task. However, it would add another system-level library to our dependencies. (I realize that most systems use zlib, but we will need to install zlib1g-dev" for the development headers. The other option is for me to implement a pure Swift version of LZ77 and deflate.
from kitura.
Actually just found this. Nice favorable license, just needs a little code cleanup for Swift 3.0. https://github.com/1024jp/NSData-GZIP/blob/master/README.md
from kitura.
I created a zLib modulemap Package.
I was able to import zLib and compile the following code, however it seems to always returns -5 and prints "Buffer error" after the compress2 command. Any ideas, @billabt ?
typealias Byte = UInt8
let size: Int = 100000
var simpleData = [Byte](repeating: 3, count: size)
var dataCompressed = [Byte](repeating: 6, count: size)
simpleData[3] = 2
simpleData[4] = 1
var sizeDataCompressed: uLongf = 0
let result = compress2( &dataCompressed, &sizeDataCompressed,
&simpleData, uLong(size), Z_BEST_SPEED )
switch result {
case Z_OK:
print("Everything's OK")
case Z_BUF_ERROR:
print("Buffer error")
default:
print("Some other error")
}
BTW, I tried another approach of doing a import Compression
and using Apple's compression API. However, the build fails because Compression requires Mac OS X 10.11 (which I have), but the Open Source toolchain seems to report 10.9.
from kitura.
We could use that existing library, but I'm somewhat reluctant to bring in yet another dependency for something that's pretty easy to do on our own. Plus, we would have to change it quite a bit to get it to work on Swift 3 (and Linux).
from kitura.
Reviewed looks great.
from kitura.
Related Issues (20)
- Update CLA HOT 1
- NET::ERR_CERT_COMMON_NAME_INVALID
- Exported OpenApi uses unexpected type for date. HOT 1
- XCode 12 Build broken due to static package dependency HOT 10
- [Question]Is it possible set Kitura-NIO as default in Xcode 11.6 HOT 2
- [Question]It is possible set custom working dir(without using Xcode)?
- [Issue]Swift-Kuery-SQLite (Release 2.0.200) in Xcode HOT 4
- Kitura cannot build and run project HOT 1
- Is it possible use response to render html string? HOT 3
- Document SwaggerDocument
- Kitura.dev should point to valid Slack group HOT 3
- Some tests need investigation
- BUG DETECTED: wait() error when using SwiftyRequest, CouchDB and NIO
- upgrade from 0.1.0 to 0.2.1, kitura command totally mess up HOT 3
- No support for Get with ID and Query params
- align dependencies URLs HOT 1
- Investigate alternative CI systems
- Thank you dannys42! HOT 1
- Odd behavior when 2 simultaneous POST requests happen HOT 1
- Slack link on web page is broken HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kitura.