Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.51 KB

README.md

File metadata and controls

62 lines (43 loc) · 1.51 KB

SwiftyDeflate

A Swift package that offers simple compression (deflate) and decompression (inflate) functionalities built on top of zlib.

Swift Platforms

Features

  • Compression using deflate
  • Decompression using inflate
  • Customizable compression levels
  • Seamless integration with Data type in Swift

Installation

Swift Package Manager

Add the following line to the dependencies in your Package.swift file:

.package(url: "https://github.com/stremovskyy/SwiftyDeflate.git", from: "1.0.0")

Usage

Deflate (Compression)

do {
    let originalData: Data = ... // Your data
    let compressedData = try originalData.deflateCompress()
    // Use compressedData
} catch {
    print("Error during compression: \(error.localizedDescription)")
}

Inflate (Decompression)

do {
    let compressedData: Data = ... // Your compressed data
    let decompressedData = try compressedData.deflateDecompress()
    // Use decompressedData
} catch {
    print("Error during decompression: \(error.localizedDescription)")
}

Requirements

  • Swift 5.3+
  • macOS, iOS, watchOS, tvOS

Contributing

Contributions are very welcome! Please submit a pull request or create an issue to share your improvements or report bugs.

License

SwiftyDeflate is released under the MIT License. See LICENSE for details.