Coder Social home page Coder Social logo

jjc1138 / data-compression Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leemorgan/nsdata-compression

3.0 2.0 1.0 136 KB

Extensions to Swift Foundation's Data type to add compression and decompression using libcompression

License: MIT License

Swift 100.00%

data-compression's Introduction

⚠️ Deprecated and No Longer Maintained ⚠️

In iOS 13 and Apple's other 2019 operating system releases there are new built-in methods on NSData for compressing and decompressing data, so I (@JJC1138) won't be making any further updates to this library and would encourage you to move to the native methods when possible.

Purpose

Compression is a set of extensions to Swift's Foundation Data type that provide data compression and decompression functionality by wrapping libcompression, a new library available on OS 10.11 and iOS 9.0

Compression is written in Swift. For the Objective-C version see LAMCompression.

Installation

To use the Compression extensions in an app, include the Data+Compression.swift file in your project.

You will also need to include the libcompression library in your project.

Data Extensions

func compressed(using: Compression) -> Data?

Returns a Data object created by compressing the receiver using the given compression algorithm.


func uncompressed(using: Compression) -> Data?

Returns a Data object by uncompressing the receiver using the given compression algorithm.


init?(contentsOfArchive: String, usedCompression: Compression?)

Returns a Data object initialized by decompressing the data from the file specified by contentsOfArchive using the given usedCompression algorithm.


init?(contentsOfArchive: String)

Returns a Data object initialized by decompressing the data from the file specified by contentsOfArchive. Attempts to determine the appropriate decompression algorithm using the path's extension.

This method is equivalent to Data(contentsOfArchive:usedCompression:) with nil usedCompression

Documentation

The Data+Compression extension is documented using standard Xcode doc comments.

The project has a dummy (skeleton) app which is included to support Unit Testing with Xcode. The app itself doesn't do anything interesting at all.

Supported OS & SDK Versions

Compression relies on CompressionLib which is only available in OS 10.11 and iOS 9.0 and later.

Background Information

Tinkering with CompressionLib

Tinkering with CompressionLib (Part 2)

Tinkering with CompressionLib (Part 3)

By Lee Morgan. If you find this useful please let me know. I'm @leemorgan on twitter.

License

The license is contained in the "License.txt" file.

data-compression's People

Contributors

erikt avatar jjc1138 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

strike65

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.