Swiftpack.co - 1024jp/GzipSwift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by 1024jp.
1024jp/GzipSwift 6.0.1
Swift package that enables gzip/gunzip Data using zlib
⭐️ 508
🕓 43 weeks ago
.package(url: "https://github.com/1024jp/GzipSwift.git", from: "6.0.1")

GzipSwift

platform CI Status SwiftPM-compatible

GzipSwift is a framework with an extension of Data written in Swift. It enables compress/decompress gzip using zlib.

Usage

import Gzip

// gzip
let compressedData: Data = try! data.gzipped()
let optimizedData: Data = try! data.gzipped(level: .bestCompression)

// gunzip
let decompressedData: Data
if data.isGzipped {
    decompressedData = try! data.gunzipped()
} else {
    decompressedData = data
}

Installation

GzipSwift is SwiftPM-compatible. To install, add this package to your Package.swift or your Xcode project.

dependencies: [
    .package(name: "Gzip", url: "https://github.com/1024jp/GzipSwift", from: Version(6, 0, 0)),
],

For Linux

  1. Install zlib if you haven't installed yet:

    $ apt-get install zlib-dev
    
  2. Add this package to your package.swift.

  3. If Swift build failed with a linker error:

    • check if libz.so is in your /usr/local/lib
      • if no, reinstall zlib as step (1)
      • if yes, link the library manually by passing '-Xlinker -L/usr/local/lib' with swift build

License

© 2014-2024 1024jp

GzipSwift is distributed under the terms of the MIT License. See LICENSE for details.

GitHub

link
Stars: 508
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics