All Projects → marmelroy → Zip

marmelroy / Zip

Licence: mit
Swift framework for zipping and unzipping files.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
shell
77523 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Zip

unzip
Tiny unzip helper class for .NET 3.5 Client Profile and Mono 2.10, written in pure C#.
Stars: ✭ 25 (-98.82%)
Mutual labels:  compression, zip, unzip
Zip
A portable, simple zip library written in C
Stars: ✭ 596 (-71.89%)
Mutual labels:  zip, compression
Libzip
A C library for reading, creating, and modifying zip archives.
Stars: ✭ 379 (-82.12%)
Mutual labels:  zip, compression
Peazip
Free Zip / Unzip software and Rar file extractor. Cross-platform file and archive manager. Features volume spanning, compression, authenticated encryption. Supports 7Z, 7-Zip sfx, ACE, ARJ, Brotli, BZ2, CAB, CHM, CPIO, DEB, GZ, ISO, JAR, LHA/LZH, NSIS, OOo, PAQ/LPAQ, PEA, QUAD, RAR, RPM, split, TAR, Z, ZIP, ZIPX, Zstandard.
Stars: ✭ 827 (-60.99%)
Mutual labels:  zip, compression
cross-unzip
Cross-platform 'native' unzip in Node.js
Stars: ✭ 17 (-99.2%)
Mutual labels:  zip, unzip
lzbase62
LZ77(LZSS) based compression algorithm in base62 for JavaScript.
Stars: ✭ 38 (-98.21%)
Mutual labels:  compression, zip
Minizip Ng
Fork of the popular zip manipulation library found in the zlib distribution.
Stars: ✭ 750 (-64.62%)
Mutual labels:  zip, compression
ratarmount
Random Access Read-Only Tar Mount
Stars: ✭ 217 (-89.76%)
Mutual labels:  compression, zip
Scarab
A system to patch your content files.
Stars: ✭ 38 (-98.21%)
Mutual labels:  files, compression
Zip
Efficient library for manipulating zip archives
Stars: ✭ 69 (-96.75%)
Mutual labels:  zip, compression
Zippy
Pure Nim implementation of deflate, zlib, gzip and zip.
Stars: ✭ 88 (-95.85%)
Mutual labels:  zip, compression
uncompress.js
Uncompress ZIP, RAR, and TAR files with pure JavaScript
Stars: ✭ 79 (-96.27%)
Mutual labels:  zip, unzip
aspZip
A classic ASP zip and unzip utility class that uses the native zip support from Windows (XP and above) - no components needed
Stars: ✭ 24 (-98.87%)
Mutual labels:  zip, unzip
Gulp Zip
ZIP compress files
Stars: ✭ 262 (-87.64%)
Mutual labels:  zip, compression
rc-zip
Pure rust zip & zip64 reading and writing
Stars: ✭ 93 (-95.61%)
Mutual labels:  compression, zip
Leanify
lightweight lossless file minifier/optimizer
Stars: ✭ 694 (-67.26%)
Mutual labels:  zip, compression
Zipstorer
A Pure C# Class to Store Files in Zip
Stars: ✭ 139 (-93.44%)
Mutual labels:  zip, compression
box
Box - Open Standard Archive Format, a zip killer.
Stars: ✭ 38 (-98.21%)
Mutual labels:  compression, zip
zip-bucket
zips files in a Google Cloud Storage [tm] bucket
Stars: ✭ 32 (-98.49%)
Mutual labels:  compression, zip
Zipper
🗳A library to create, read and modify ZIP archive files, written in Swift.
Stars: ✭ 38 (-98.21%)
Mutual labels:  zip, compression

Zip - Zip and unzip files in Swift

Build Status Version Carthage compatible SPM supported

Zip

A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Usage

Import Zip at the top of the Swift file.

import Zip

Quick functions

The easiest way to use Zip is through quick functions. Both take local file paths as NSURLs, throw if an error is encountered and return an NSURL to the destination if successful.

do {
    let filePath = Bundle.main.url(forResource: "file", withExtension: "zip")!
    let unzipDirectory = try Zip.quickUnzipFile(filePath) // Unzip
    let zipFilePath = try Zip.quickZipFiles([filePath], fileName: "archive") // Zip
}
catch {
  print("Something went wrong")
}

Advanced Zip

For more advanced usage, Zip has functions that let you set custom destination paths, work with password protected zips and use a progress handling closure. These functions throw if there is an error but don't return.

do {
    let filePath = Bundle.main.url(forResource: "file", withExtension: "zip")!
    let documentsDirectory = FileManager.default.urls(for:.documentDirectory, in: .userDomainMask)[0]
    try Zip.unzipFile(filePath, destination: documentsDirectory, overwrite: true, password: "password", progress: { (progress) -> () in
        print(progress)
    }) // Unzip

    let zipFilePath = documentsFolder.appendingPathComponent("archive.zip")
    try Zip.zipFiles([filePath], zipFilePath: zipFilePath, password: "password", progress: { (progress) -> () in
        print(progress)
    }) //Zip

}
catch {
  print("Something went wrong")
}

Custom File Extensions

Zip supports '.zip' and '.cbz' files out of the box. To support additional zip-derivative file extensions:

Zip.addCustomFileExtension("file-extension-here")

[Preferred] Setting up with Swift Package Manager

To use Zip with Swift Package Manager, add it to your package's dependencies:

.package(url: "https://github.com/marmelroy/Zip.git", .upToNextMinor(from: "2.1"))

Setting up with CocoaPods

source 'https://github.com/CocoaPods/Specs.git'
pod 'Zip', '~> 2.1'

Setting up with Carthage

To integrate Zip into your Xcode project using Carthage, specify it in your Cartfile:

github "marmelroy/Zip" ~> 2.1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].