Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
buh authored Sep 29, 2023
1 parent 16bc8fd commit 0782d5b
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

Imagine 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.

It makes a request to a remote ZIP archive and returns its structure with the 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.
It 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.

<img src="https://github.com/buh/ZipPinch/assets/284922/316c0139-9abf-4bd9-aa8e-dcd3ac48501f" width="375"/> <img src="https://github.com/buh/ZipPinch/assets/284922/9e06fb2f-1be3-476a-84eb-f58ed1e75c90" width="375"/>

*Screenshots from the Demo app: Hubble*

# Requirements

Expand All @@ -24,11 +28,41 @@ https://github.com/buh/ZipPinch.git

# Usage

# Demo
1. First you need to create an instance of `URLSession`.

```swift
let urlSession = URLSession(configuration: .ephemeral)
```

Then make a request for the contents via a direct `URL` to your ZIP file.

```swift
let entries = try await urlSession.zipEntries(from: url)
```

> [!NOTE]
> You can also add a `URLSessionTaskDelegate` or use a customised `URLRequest`.
2. Then when you have selected the necessary entry to download, you need to make the following request:

```swift
let data = try await urlSession.zipEntryData(entry, from: url)
```

3. Use the data to initiate an image or other types.

Check out the Hubble demo app to view selected images from the archive taken by [The Hubble Space Telescope](https://esahubble.org).

# TODO
[ ] Add more tests
[ ] Fix Demo for macOS
- [x] Add custom `URLRequest`
- [x] Add custom decompressor
- [ ] Add more tests
- [ ] Fix Demo for macOS

# ZIP file format specification sources
- [Wikipedia](http://en.wikipedia.org/wiki/ZIP_(file_format)#File_headers)
- [PKWARE ZIP File Format Specification](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.9.TXT)
- [Fossies](https://fossies.org/linux/unzip/proginfo/extrafld.txt)

# Support

Expand Down

0 comments on commit 0782d5b

Please sign in to comment.