Giter Site home page Giter Site logo

swiftzstd's Introduction

SwiftZSTD

Swift Wrapper around ZSTD Compression Library

Compression and de-compression of in-memory buffers is supported, with or without a context or a dictionary. Buffers are represented by Data instances. To be decompressed by this code, a buffer must be a complete frame with decompressed size encoded in it and retrievable using ZSTD_getDecompressedSize().

This is actually a fairly useful implementation. Experimentation shows that even fairly large files (100s of MB),when compressed using the zstd utility provided with the C library, end up in a single frame, which is easily decompressible by this Swift code if read into memory as one piece!

Streaming compression and decompression is also supported, but not with a dictionary, as streaming operations that use a dictionary are experimental in the underlying C library.

The relevant ZSTD C code has been added to the repository since it is compiled as part of the Xcode project. See https://github.com/facebook/zstd for additional information, including licensing.

The wrapper is packaged as a framework and includes the ZSTD C code as part of the target. Other approaches could have been used, e.g. the ZSTD lib could have been packaged as an external library, static or dynamic.

swiftzstd's People

Contributors

aperedera avatar clementtroesch avatar omniprog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

swiftzstd's Issues

How to integrate into an iOS project

Thanks for creating this library. Could you please write down some guideline to integrate this project into an iOS project? Or it would be great if it is published on CocoaPods. Thank you in advance!

Swift Package Manager Library

Hi, Thanks for your great effort. Do you have any plan to pack your code az an SPM package? I tried to do it myself but I found out it has Objective-C code inside. I believe the package can be platform-independent without Objective-C code.

Support Swift 4.2

Can you please upgrade the library to Swift 4.2 since the next Xcode version will no longer support Swift 3.x.
Thank you!

SPM PR

I decided to wrap your code as an SPM library. As soon as I get comfortable with the PR mechanism of GitHub I'm going to send it. however, I had to exclude the Objc code for streaming since SPM currently doesn't allow mixed source code in on a target. Is there any reason that is written in Object-c rather than Swift?

Cannot install package

I get the following error when trying to install the package via File -> Add Packages

[package manifest at '/Package.swift' cannot be accessed (/Package.swift doesn't exist in file system)

freeing dictionary makes the code working only once

for my code to work I need to comment out these two lines. other than that it can decompress only once.

deinit {
       if (haveCDict) { ZSTD_freeCDict(compDict) }
       if (haveDDict) { ZSTD_freeDDict(decompDict) }
}

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.