{"id":20716312,"url":"https://github.com/buh/zippinch","last_synced_at":"2025-04-23T13:20:45.792Z","repository":{"id":24464394,"uuid":"27867706","full_name":"buh/ZipPinch","owner":"buh","description":"Remote access to files inside a ZIP file for macOS, iOS and watchOS.","archived":false,"fork":false,"pushed_at":"2024-09-13T13:11:05.000Z","size":191,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T03:47:59.127Z","etag":null,"topics":["ios","ipados","macos","msdos","spm","swift","urlsession","watchos","zip"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://www.buymeacoffee.com/bukhtin","https://paypal.me/bukhtin"]}},"created_at":"2014-12-11T11:15:25.000Z","updated_at":"2025-02-03T18:52:33.000Z","dependencies_parsed_at":"2023-10-12T02:44:55.911Z","dependency_job_id":"5760ae92-e687-4fd0-828d-5bbc00281c58","html_url":"https://github.com/buh/ZipPinch","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buh%2FZipPinch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buh%2FZipPinch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buh%2FZipPinch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buh%2FZipPinch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buh","download_url":"https://codeload.github.com/buh/ZipPinch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250439367,"owners_count":21430838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","ipados","macos","msdos","spm","swift","urlsession","watchos","zip"],"created_at":"2024-11-17T03:05:27.447Z","updated_at":"2025-04-23T13:20:45.760Z","avatar_url":"https://github.com/buh.png","language":"Swift","funding_links":["https://www.buymeacoffee.com/bukhtin","https://paypal.me/bukhtin"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"640\" alt=\"ZipPinch cover\" src=\"https://github.com/buh/ZipPinch/assets/284922/d261cb36-e552-4866-a9ad-ffab5442601b\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://swiftpackageindex.com/buh/ZipPinch\"\u003e\n    \u003cimg src=\"https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbuh%2FZipPinch%2Fbadge%3Ftype%3Dswift-versions\" /\u003e\n    \u003cimg src=\"https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbuh%2FZipPinch%2Fbadge%3Ftype%3Dplatforms\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/buh/CompactSlider/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/buh/ZipPinch\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n`ZipPinch` is an extension for `URLSession` to work with zip files remotely. It reads the contents of a zip file without downloading it itself and decompresses the desired files.\n\nImagine that you need remote access to several files (different kinds of assets: pictures, fonts, etc.). And these files can be changed and added to. Perhaps these files are grouped, for example, by locale and your app needs assets for a particular locale. In a good way you need a server solution that returns some JSON with a description of available resources. For example, you can use any PaaS, but `ZipPinch` offers a much simpler solution. \n\nIt makes a request to a remote ZIP archive and returns its structure with the file size and date of file modification. Free hosting for your zip files is not hard to find. Files in an uncompressed archive will essentially be downloaded as is and no time will be spent on unzipping.\n\n\u003cimg src=\"https://github.com/buh/ZipPinch/assets/284922/7798de6e-6dc1-455d-befb-6b6a33954180\" width=\"375\"/\u003e \u003cimg src=\"https://github.com/buh/ZipPinch/assets/284922/b94f1e0d-c13e-43f0-aeac-740f18ba9569\" width=\"375\"/\u003e\n\n*Screenshots from the Demo app: Hubble*\n\n# Requirements\n\n- Swift 5.6+\n- macOS 12+\n- iOS 15+\n- watchOS 8+\n\n# Installation\n\n1. In Xcode go to `File` ⟩ `Add Packages...`\n2. Search for the link below and click `Add Package`\n```\nhttps://github.com/buh/ZipPinch.git\n```\n3. Select to which target you want to add it and select `Add Package`\n\n# Usage\n## Getting started\n\n1. First you need to create an instance of `URLSession`.  Then make a request for the contents via a direct `URL` to your ZIP file.\n\n```swift\nlet urlSession = URLSession(configuration: .default)\nlet entries = try await urlSession.zipEntries(from: url)\n```\n\n\u003e [!NOTE]\n\u003e You can also add a `URLSessionTaskDelegate` or use a customised `URLRequest`.\n\n2. Download the data of an entry:\n\n```swift\nlet data = try await urlSession.zipEntryData(entry, from: url)\n```\n\n3. Use the data to initiate an image or other types.\n\nCheck out the Hubble demo app to view selected images from the archive taken by [The Hubble Space Telescope](https://esahubble.org).\n\n## Download with progress\n\nTo download with showing the progress, a `ZIPProgress` object must be specified:\n\n```swift\nlet data = try await urlSession.zipEntryData(entry, from: url, progress: .init() { progressValue in\n    Task { @MainActor in\n        self.progress = progressValue\n    }\n})\n```\n\n## Download folder\n\n1. Converting entries to a tree hierarchy with folders and enrties:\n```swift\nlet entries = try await urlSession.zipEntries(from: url)\nlet rootFolder = entries.rootFolder()\n```\n2. Recursively load folder and subfolder entries:\n```swift\n// folderData: [(entry: ZIPEntry, data: Data)]\nlet folderData = try await urlSession.zipFolderData(folder, from: url)\n```\n3. The same, but with the overall progress:\n```swift\n// folderData: [(entry: ZIPEntry, data: Data)]\nlet folderData = try await urlSession.zipFolderData(folder, from: url, progress: .init() { progressValue in\n    Task { @MainActor in\n        self.progress = progressValue\n    }\n})\n```\n\n# Features\n- [x] Custom `URLRequest`\n- [x] Task management with `URLSessionTaskDelegate`\n- [x] Support for a custom decompressor\n- [x] ZIP 64-bit support\n- [x] Tracking the downloading progress\n- [x] Demo for iPhone/iPad/macOS.\n- [x] ZIP entries as a tree of Folders/Files.\n- [x] Dowload a folder.\n\n# ZIP file format specification sources\n- [Wikipedia](http://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers)\n- [PKWARE ZIP File Format Specification](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.9.TXT)\n- [Fossies](https://fossies.org/linux/unzip/proginfo/extrafld.txt)\n\n# Support\n\nYou can buy me a coffee [here](https://www.buymeacoffee.com/bukhtin) ☕️\n\n# License\n\n`ZipPinch` is available under the [MIT license](https://github.com/buh/ZipPinch/blob/main/LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuh%2Fzippinch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuh%2Fzippinch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuh%2Fzippinch/lists"}