License Documentation GitHub stars
Ubuntu Windows CI Ubuntu CI Windows
Modern C++ client library for the Yandex.Disk REST API.
A simple, lightweight, and efficient static library for integrating Yandex.Disk cloud storage into C++ projects across platforms
-
Full API Coverage:
Upload and download files and directories, manage directories, move and rename resources, handle trash operations, publish/unpublish files, and retrieve public download links -
Robust File Management:
Recursive upload/download of directories, existence checks, and detailed resource information retrieval -
Trash Support:
List trash contents, restore files/folders to original locations, delete individual items or empty the entire trash -
Search Functionality:
Find files and folders by name both on the disk and in the trash, supporting recursive search and multiple matches -
Cross-Platform Compatibility:
Works on Windows, Linux, and macOS with support for Unicode paths -
Minimal Dependencies:
Depends only onlibcurlfor HTTP communication andnlohmann/jsonfor JSON parsing -
Easy Integration:
Provided as a static library with a clean header interface for straightforward inclusion in your projects
yandex-disk-cpp-client/
├── docs # Generated documentation via Doxygen
├── examples/ # Example usage programs
├── include/ # Public headers (YandexDiskClient.h)
├── src/ # Library source files (YandexDiskClient.cpp)
├── CMakeLists.txt # Build configuration
├── README.md # This file
├── LICENSE # License file
├── .gitignore # Git ignore rules
- C++17 compatible compiler (GCC, Clang, MSVC)
- CMake 3.14 or newer
- libcurl development files
- nlohmann/json (header-only, managed via CMake)
- Environment variable
YADISK_TOKENwith your Yandex.Disk OAuth token (full disk access)
git clone https://github.com/Krasnovvvvv/yandex-disk-cpp-client.git cd yandex-disk-cpp-client mkdir build && cd build cmake .. cmake --build . ./yandex_disk_example
#include "YandexDiskClient.h" #include <cstdlib> // for getenv int main() { const char* token = std::getenv("YADISK_TOKEN"); if (!token) { std::cerr << "Please set YADISK_TOKEN environment variable." << std::endl; return 1; } YandexDiskClient yandex(token); // Upload a file yandex.uploadFile("/backup/data.zip", "C:/local/data.zip"); // List root directory contents auto list = yandex.getResourceList("/"); std::cout << yandex.formatResourceList(list) << std::endl; return 0; }
For more examples, see
examples/
| Function | Description |
|---|---|
getQuotaInfo() |
Retrieve disk quota info (total, used, trash size) |
getResourceList(path) |
List files and folders at a given disk path |
getResourceInfo(path) |
Get detailed info about a file or folder |
uploadFile(disk_path, local_path) |
Upload a local file to disk |
downloadFile(disk_path, local_path) |
Download a file from disk to local path |
uploadDirectory(disk_path, local_path) |
Recursively upload a directory |
downloadDirectory(disk_path, local_path) |
Recursively download a directory |
deleteFileOrDir(path) |
Delete a file or directory |
createDirectory(path) |
Create a directory |
moveFileOrDir(from, to, overwrite) |
Move or rename a file or directory |
publish(path) |
Publish a file or folder (make public) |
unpublish(path) |
Remove public access |
getPublicDownloadLink(path) |
Get public download URL |
exists(path) |
Check if a file or folder exists |
getTrashResourceList(path) |
List contents of trash |
restoreFromTrash(path) |
Restore file/folder from trash to original location |
deleteFromTrash(path) |
Permanently delete from trash |
emptyTrash() |
Empty the entire trash |
findTrashPathByName(name) |
Find all trash items by name |
findResourcePathByName(name, start_path) |
Find all disk items by name, recursively |
- libcurl — for HTTP requests
- nlohmann/json — for JSON parsing
These dependencies are automatically handled via CMake (assuming installed on your system or via package managers like vcpkg)
Full API documentation is generated using Doxygen and available in the docs/ folder
You can also access the online documentation via GitHub Pages Documentation
Contributions, bug reports, and feature requests are welcome!
Please open issues or pull requests on the GitHub repository
This project is licensed under the MIT License — see License