GithubHelp home page GithubHelp logo

clemdelp / nsdata-compression Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leemorgan/nsdata-compression

0.0 1.0 0.0 228 KB

Category on NSData to add CompressionLib support

License: MIT License

Swift 100.00%

nsdata-compression's Introduction

Purpose

Compression is a category on NSData that provides data compression and decompression functionality by wrapping CompressionLib, 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 category in an app, include the NSData+Compression.swift file in your project.

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

NSData Extensions

func compressedDataUsingCompression(compression: Compression) -> NSData?

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


func uncompressedDataUsingCompression(compression: Compression) -> NSData?

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


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

Returns a NSData object initialized by decompressing the data from the file specified by path using the given compression algorithm.


convenience init?(contentsOfArchive path: String)

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

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

Documentation

The NSData+Compression category 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.

nsdata-compression's People

Watchers

 avatar

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.