Skip to content
Swift wrapper around ZSTD compression lib
Swift Objective-C C
Branch: master
Clone or download
aperedera Merge pull request #2 from ClementTroesch/master
Update for Swift 5 & Share iOS and macOS schemes for Carthage support
Latest commit 0307180 Oct 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources Update code for Swift 5 Jun 20, 2019
SwiftZSTD.xcodeproj Update code for Swift 5 Jun 20, 2019
SwiftZSTD.xcworkspace Repackaged the wrapper as a framework. Mar 5, 2017
SwiftZSTD_iOS Share iOS and macOS schemes for Carthage support Mar 22, 2019
SwiftZSTD_macOS
ZSTDSampleApp_1 Update code for Swift 5 Jun 20, 2019
ZSTDSampleApp_2 Update code for Swift 5 Jun 20, 2019
zstdlib Added streaming compression/decompression support. Oct 26, 2017
.gitattributes Adding .gitattributes to ensure GitHub determines the repo language c… Mar 30, 2018
LICENSE.md Initial commit Nov 22, 2016
README.md Updated README to reflect the current state of the project. Mar 30, 2018

README.md

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 that must use contiguous storage, and in practice most Data instances meet this requirement. 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.

You can’t perform that action at this time.