Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jurakin/parallel-downloader
Downloads file using parallel downloading (if range header is supported otherwise downloads normally).
https://github.com/jurakin/parallel-downloader
Last synced: about 2 months ago
JSON representation
Downloads file using parallel downloading (if range header is supported otherwise downloads normally).
- Host: GitHub
- URL: https://github.com/jurakin/parallel-downloader
- Owner: jurakin
- License: gpl-3.0
- Created: 2023-02-20T10:07:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-02-27T14:48:33.000Z (over 1 year ago)
- Last Synced: 2024-05-30T07:57:16.081Z (4 months ago)
- Language: Python
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Parallel Downloader
Downloads file using parallel downloading (if range header is supported otherwise downloads normally).
## How it works
The library is based on adding [range headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) to request and downloading the file in threads simultaneously.
## Instalation
- Requirements are `threading` and `requests` (built-in)
- Install from repository `python3 -m pip install git+https://github.com/jurakin/parallel-downloader`## Examples
The parallel downloader is accessible via python or a console script:
```python
parallel-downloader https://i.imgur.com/z4d4kWk.jpg cat.jpg --parts 10
```
is the same as```python
import parallel_downloader as durl = "https://i.imgur.com/z4d4kWk.jpg"
file = "cat.jpg"# download url to file using 10 parts
d.ParallelDownloader(url, file, 10).wait()
```Using `.start()` and `.wait()`:
```python
import parallel_downloader as durl = "https://i.imgur.com/z4d4kWk.jpg"
file = "cat.jpg"# download url to file using 10 parts
p = d.ParallelDownloader(url, file, 10)print("before downloading")
p.start()
print("downloading")
p.wait()
print("downloaded")
```Using `.terminate()`:
```python
import parallel_downloader as dimport time
url = "https://i.imgur.com/z4d4kWk.jpg"
file = "cat.jpg"# download url to file using 10 parts
p = d.ParallelDownloader(url, file, 10).wait()time.sleep(1)
p.terminate()
```## Result
The result image is:
![cat](./cat.jpg?raw=true)
## License
This project is released under GNU General Public License v3.0
## Credits
This project is inspired by [ulozto-downloader](https://github.com/setnicka/ulozto-downloader)'s parallel downloader.