{"id":17238328,"url":"https://github.com/hoc081098/PetrusHocDownloader","last_synced_at":"2025-04-14T02:31:45.350Z","repository":{"id":51339648,"uuid":"280450108","full_name":"hoc081098/PetrusHocDownloader","owner":"hoc081098","description":"Petrus Hoc's Downloader - Simple, reactive and functional downloader for iOS Swift with the power of RxSwift, RxAlamofire - RxSwift Downloader - RxDownloader","archived":false,"fork":false,"pushed_at":"2024-10-23T19:34:25.000Z","size":96,"stargazers_count":9,"open_issues_count":9,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T05:38:16.709Z","etag":null,"topics":["functional-reactive-programming","ios","ios-rx-downloader","rxalamofire","rxdownload","rxswift","swift","swift-downloader","swift5","swifty-downloader"],"latest_commit_sha":null,"homepage":"https://cocoapods.org/pods/PhDownloader","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/hoc081098.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2020-07-17T14:47:28.000Z","updated_at":"2025-03-17T05:46:01.000Z","dependencies_parsed_at":"2024-03-08T03:23:33.404Z","dependency_job_id":"cc155702-2901-4c45-aebf-0f77d35c1590","html_url":"https://github.com/hoc081098/PetrusHocDownloader","commit_stats":{"total_commits":43,"total_committers":3,"mean_commits":"14.333333333333334","dds":"0.046511627906976716","last_synced_commit":"e29ccddb2c1ca6a8965aa4673ef303515535ea0d"},"previous_names":["hoc081098/petrushocdownloader","hoc081098/phdownloader"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2FPetrusHocDownloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2FPetrusHocDownloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2FPetrusHocDownloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoc081098%2FPetrusHocDownloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoc081098","download_url":"https://codeload.github.com/hoc081098/PetrusHocDownloader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248810883,"owners_count":21165195,"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":["functional-reactive-programming","ios","ios-rx-downloader","rxalamofire","rxdownload","rxswift","swift","swift-downloader","swift5","swifty-downloader"],"created_at":"2024-10-15T05:45:14.795Z","updated_at":"2025-04-14T02:31:44.985Z","avatar_url":"https://github.com/hoc081098.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhDownloader (Petrus Hoc's Downloader)\nSimple, reactive and functional downloader for iOS Swift with the power of `RxSwift`, `RxAlamofire`.\nRxSwift Downloader.\nRxDownloader.\n\n[![iOS Build CI](https://github.com/hoc081098/PhDownloader/actions/workflows/ios-build.yml/badge.svg)](https://github.com/hoc081098/PhDownloader/actions/workflows/ios-build.yml)\n[![Version](https://img.shields.io/cocoapods/v/PhDownloader.svg?style=flat)](https://cocoapods.org/pods/PhDownloader)\n[![License](https://img.shields.io/cocoapods/l/PhDownloader.svg?style=flat)](https://cocoapods.org/pods/PhDownloader)\n[![Platform](https://img.shields.io/cocoapods/p/PhDownloader.svg?style=flat)](https://cocoapods.org/pods/PhDownloader)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fhoc081098%2FPhDownloader\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n## Installation\n\nPhDownloader is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'PhDownloader'\n```\n\n## Author\n\nPetrus Nguyễn Thái Học, hoc081098@gmail.com\n\n## Usagement\n\n### Create downloader\n```swift\nlet downloader: PhDownloader = PhDownloaderFactory.makeDownloader(\n    with: .init(\n        maxConcurrent: 2,\n        throttleProgress: .milliseconds(500)\n    )\n)\n```\n\n### Obseve download result (for showing snackbar, toast, alert, ...)\n```swift\ndownloader\n    .downloadResult$\n    .subscribe(onNext: { result in\n        switch result {\n        case .success(let request):\n          ...\n        case .failure(let request, let error):\n          ...\n        case .cancelled(let request):\n          ...\n        }\n    })\n    .disposed(by: disposeBag)\n```\n\n### Obseve download state (for updating UI)\n```swift\ndownloader\n    .observe(by: [\"id1\", \"id2\", \"id3\"])\n    .subscribe(onNext: { tasks in\n        ...\n    })\n    .disposed(by: disposeBag)\n\ndownloader\n    .observe(by: \"Request id\")\n    .subscribe(onNext: { task in \n        ...\n    })\n    .disposed(by: disposeBag)\n```\n\n### Enqueue, cancel, cancelAll, remove:\n```swift\n\nlet id = \"Request id\"\n\ndownloader\n    .enqueue(\n        .init(\n            identifier: id,\n            url: URL(string: \"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_1920_18MG.mp4\")!,\n            fileName: \"test_file_\\(id).mp4\",\n            savedDir: FileManager.default\n                .urls(for: .documentDirectory, in: .userDomainMask)\n                .first!\n                .appendingPathComponent(\"downloads\", isDirectory: true)\n        )\n    )\n    .subscribe()\n    .disposed(by: disposeBag)\n\ndownloader\n    .cancel(by: id)\n    .subscribe()\n    .disposed(by: disposeBag)\n\ndownloader\n    .cancelAll()\n    .subscribe()\n    .disposed(by: disposeBag)\n    \ndownloader\n    .remove(identifier: id)\n    .subscribe()\n    .disposed(by: disposeBag)\n```\n\n## License\n\nPhDownloader is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoc081098%2FPetrusHocDownloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoc081098%2FPetrusHocDownloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoc081098%2FPetrusHocDownloader/lists"}