GithubHelp home page GithubHelp logo

Comments (7)

billabt avatar billabt commented on April 30, 2024 1

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.

dfirsht avatar dfirsht commented on April 30, 2024

Just providing this link as reference to the team: https://en.wikipedia.org/wiki/HTTP_compression

from kitura.

rfdickerson avatar rfdickerson commented on April 30, 2024

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.

billabt avatar billabt commented on April 30, 2024

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.

rfdickerson avatar rfdickerson commented on April 30, 2024

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.

rfdickerson avatar rfdickerson commented on April 30, 2024

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.

shmuelk avatar shmuelk commented on April 30, 2024

Reviewed looks great.

from kitura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.