Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icanzilb/safaridownload
Swift package to read Safari's download packages
https://github.com/icanzilb/safaridownload
Last synced: 20 days ago
JSON representation
Swift package to read Safari's download packages
- Host: GitHub
- URL: https://github.com/icanzilb/safaridownload
- Owner: icanzilb
- License: mit
- Created: 2023-11-11T10:48:02.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-11T11:30:16.000Z (about 1 year ago)
- Last Synced: 2024-10-04T19:52:48.199Z (about 1 month ago)
- Language: Swift
- Size: 6.84 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SafariDownload
Swift package to read Safari's download packages> Note: This package just reads a few of the available keys in the plist in the download bundle. It might be in-comprehensive or incorrect.
Get the current download progress:
```swift
let download = try SafariDownloadModel(
url: URL(fileURLWithPath: "/Users/me/Downloads/MyFile.zip.download"),
noObservation: true
)print(download.originURL)
print(download.bytesDownloaded)
print(model.bytesTotal)
```Observe the download progress with Combine:
```swift
let download = try SafariDownloadModel(
url: URL(fileURLWithPath: "/Users/me/Downloads/MyFile.zip.download")
)download.$bytesDownloaded.sink { byteCount in
print("Currently downloaded: \(byteCount) bytes")
}.store(in: &subscriptions)
```__Credits__: Marin Todorov, [https://underplot.com](underplot.com)
__License__: MIT