https://github.com/winsoft666/zoe
C++ File Download Library.
https://github.com/winsoft666/zoe
aria downloader libcurl
Last synced: 10 days ago
JSON representation
C++ File Download Library.
- Host: GitHub
- URL: https://github.com/winsoft666/zoe
- Owner: winsoft666
- License: mit
- Created: 2019-11-26T09:24:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-20T04:22:05.000Z (3 months ago)
- Last Synced: 2025-05-09T00:07:37.315Z (10 days ago)
- Topics: aria, downloader, libcurl
- Language: C++
- Homepage:
- Size: 687 KB
- Stars: 43
- Watchers: 2
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Zoe
[](https://github.com/microsoft/vcpkg/tree/master/ports/zoe)
[](https://github.com/winsoft666/zoe/blob/master/LICENSE)English | [ 简体中文](README_ch.md)
A C++ file download library.
## Features
- Multi-protocol, such as HTTP(s), FTP(s)...
- Multi-threaded Segmented downloads and breakpoint transmission.
- Limit download speed.- Disk cache.
- Support large file (PB level).
- Compatible with server leeching detection(or limit).
## Compile and Install
Zoe only depends on [curl](https://github.com/curl/curl). After installing curl, use CMake to compile and install Zoe.
In addition, the `Zoe` library has been included in Microsoft's [vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/zoe), which can be quickly installed directly using the following command:
```bash
vcpkg install zoe
```> If running the test case fails, check if the download link in the http_test_datas variable (test_data.h) is valid.
## Getting Started
The following example uses Zoe's default configuration parameters to demonstrate how to quickly use Zoe to download file:
```cpp
#include
#include "zoe.h"int main(int argc, char** argv) {
using namespace zoe;Zoe::GlobalInit();
Zoe z;
std::shared_future r = z.start(u8"http://xxx.xxx.com/test.exe", u8"D:\\test.exe");Result result = r.get();
Zoe::GlobalUnInit();
return 0;
}
```The following example is a bit more complex and sets some configuration parameters and callback functions:
```cpp
#include
#include "zoe.h"int main(int argc, char** argv) {
using namespace zoe;Zoe::GlobalInit();
Zoe z;
z.setThreadNum(10); // Optional
z.setTmpFileExpiredTime(3600); // Optional
z.setDiskCacheSize(20 * (2 << 19)); // Optional
z.setMaxDownloadSpeed(50 * (2 << 19)); // Optional
z.setHashVerifyPolicy(ALWAYS, MD5, "6fe294c3ef4765468af4950d44c65525"); // Optional, support MD5, CRC32, SHA256
// There are more options available, please check zoe.h
z.setVerboseOutput([](const utf8string& verbose) { // Optional
printf("%s\n", verbose.c_str());
});
z.setHttpHeaders({ // Optional
{u8"Origin", u8"http://xxx.xxx.com"},
{u8"User-Agent", u8"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)"}
});
std::shared_future r = z.start(
u8"http://xxx.xxx.com/test.exe", u8"D:\\test.exe",
[](Result result) { // Optional
// result callback
},
[](int64_t total, int64_t downloaded) { // Optional
// progress callback
},
[](int64_t byte_per_secs) { // Optional
// real-time speed callback
});r.wait();
Zoe::GlobalUnInit();
return 0;
}
```## Command-line tool
`zoe_tool` is command-line tool based on `zoe` library.
Usage:
```bash
zoe_tool URL TargetFilePath [ThreadNum] [DiskCacheMb] [MD5] [TmpExpiredSeconds] [MaxSpeed]
```- URL: Download URL.
- TargetFilePath: target file saved path.
- ThreadNum: thread number, optional, default is `1`.
- DiskCacheMb: Disk cache size(Mb), default is `20Mb`.
- MD5: target file md5, optional, if this value isn't empty, tools will check file md5 after download finished.
- TmpExpiredSeconds: seconds, optional, the temporary file will expired after these senconds.
- MaxSpeed: max download speed(byte/s).## Sponsor
Thank you for using this project. It would be a great pleasure for me if this project can be of help to you.**You can go to my Github [homepage](https://github.com/winsoft666) to make a donation.**